Logfile creation
This commit is contained in:
parent
dbb6b97f40
commit
4b5e6baf0b
2 changed files with 17 additions and 4 deletions
17
local.yml
17
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
|
||||
- name: dotfiles
|
||||
|
|
|
|||
|
|
@ -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 }}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue