73 lines
1.6 KiB
YAML
73 lines
1.6 KiB
YAML
# tasks to complete before running roles
|
|
- hosts: all
|
|
collections:
|
|
- ansible.posix
|
|
- community.general
|
|
tags: always
|
|
become: true
|
|
pre_tasks:
|
|
# - name: "pre-run | update package cache (arch)"
|
|
# tags: always
|
|
# community.general.pacman: update_cache=yes
|
|
# changed_when: False
|
|
# when: ansible_distribution == "Archlinux"
|
|
|
|
- name: "pre-run | update package cache (debian, etc)"
|
|
tags: always
|
|
apt: update_cache=yes
|
|
changed_when: False
|
|
when: ansible_distribution in ["Debian", "Ubuntu"]
|
|
|
|
# run roles
|
|
- hosts: all
|
|
collections:
|
|
- ansible.posix
|
|
- community.general
|
|
tags: base
|
|
become: true
|
|
roles:
|
|
- base
|
|
|
|
- hosts: work
|
|
tags: work
|
|
become: true
|
|
roles:
|
|
- work
|
|
|
|
# - hosts: server
|
|
# 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
|
|
apt:
|
|
autoclean: yes
|
|
changed_when: false
|
|
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
|
|
|
- name: autoremove orphan packages (debian and ubuntu)
|
|
tags: always
|
|
apt:
|
|
autoremove: yes
|
|
purge: yes
|
|
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
|
|
|
# - name: send completion alert
|
|
# include_tasks: playbooks/send_completion_alert.yml
|
|
# tags: always
|
|
# when:
|
|
# - task_failed is not defined
|
|
|
|
# - name: send failure alert
|
|
# include_tasks: playbooks/send_failure_alert.yml
|
|
# tags: always
|
|
# when:
|
|
# - task_failed is defined
|
|
# - task_failed == true
|