--- - name: "Playbook for my various machines" hosts: localhost connection: local force_handlers: true vars: log_path: "/var/log/ansible/{{ ansible_date_time.iso8601_basic_short }}.log" pre_tasks: - name: "Create Logfile" block: - name: "Create File" ansible.builtin.file: path: "{{ log_path }}" state: touch mode: '0644' roles: - name: fedora when: ansible_distribution == 'Fedora' - name: gnome when: ansible_env.DESKTOP_SESSION == 'gnome' - name: dotfiles