Repository navigation
Expand file tree
/
Copy pathlocal.yml
More file actions
80 lines (70 loc) · 2.01 KB
/
Copy pathlocal.yml
File metadata and controls
80 lines (70 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# tasks to complete before running roles
- hosts: all
tags: always
become: true
pre_tasks:
- name: pre-run | update package cache (debian, etc)
tags: always
ansible.builtin.apt:
update_cache: true
changed_when: false
when: ansible_facts.distribution in ["Debian", "Linux Mint", "Ubuntu"]
- name: pre-run | update package cache (fedora, rhel, etc)
tags: always
ansible.builtin.dnf:
update_cache: true
changed_when: false
when: ansible_facts.os_family == "RedHat"
# run roles
- hosts: all
tags: base
become: true
roles:
- base
- hosts: workstation
tags: workstation
become: true
roles:
- workstation
- hosts: [server, proxmoxhosts]
tags: server
become: true
roles:
- server
# end of run cleanup and reporting
- hosts: all
become: true
tasks:
- name: cleanup package cache (debian and ubuntu)
tags: always
ansible.builtin.apt:
autoclean: true
changed_when: false
when: ansible_facts.distribution in ["Debian", "Linux Mint", "Ubuntu"]
- name: autoremove orphan packages (debian and ubuntu)
tags: always
ansible.builtin.apt:
autoremove: true
purge: true
when: ansible_facts.distribution in ["Debian", "Linux Mint", "Ubuntu"]
- name: cleanup package cache (fedora, rhel, etc)
tags: always
ansible.builtin.command: dnf clean packages
changed_when: false
when: ansible_facts.os_family == "RedHat"
- name: autoremove orphan packages (fedora, rhel, etc)
tags: always
ansible.builtin.dnf:
autoremove: true
when: ansible_facts.os_family == "RedHat"
- name: send completion alert
ansible.builtin.include_tasks: playbooks/send_completion_alert.yml
tags: always
when:
- task_failed is not defined
- name: send failure alert
ansible.builtin.include_tasks: playbooks/send_failure_alert.yml
tags: always
when:
- task_failed is defined
- task_failed == true