diff --git a/local.yml b/local.yml index d769978..af4aeab 100644 --- a/local.yml +++ b/local.yml @@ -1,11 +1,24 @@ --- -- hosts: localhost +- 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 \ No newline at end of file + - name: dotfiles diff --git a/roles/fedora/tasks/main.yml b/roles/fedora/tasks/main.yml index 146c1a5..4e7d102 100644 --- a/roles/fedora/tasks/main.yml +++ b/roles/fedora/tasks/main.yml @@ -21,7 +21,7 @@ msg: "rpmfusion Repos konnten nicht hinzugefügt werden." - name: "Remove and install dnf software" - become: true + become: true block: - name: "Remove unnecassary packages" ansible.builtin.dnf: @@ -43,7 +43,7 @@ rescue: - name: "Log errors" ansible.builtin.lineinfile: - dest: /tmp/ansible.log + dest: "{{ log_path }}" line: >- [ERR] {{ item }} with_items: "{{ dnf_install_errors.failures }}"