Refactor inventory into OS groups and update playbooks accordingly
Group hosts by OS (ubuntu/rocky) in inventory, refactor playbooks to use group-targeted plays instead of ansible_os_family conditionals, add bot host, and add Docker volume backup playbook via rsync to storage.
This commit is contained in:
+12
-19
@@ -21,33 +21,26 @@
|
||||
when: ping_result is not succeeded
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Update and Upgrade Packages
|
||||
hosts: reachable_hosts
|
||||
- name: Update and Upgrade - Ubuntu
|
||||
hosts: ubuntu:&reachable_hosts
|
||||
become: true
|
||||
gather_facts: true
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Update & Upgrade - Debian-based systems
|
||||
- name: Update & Upgrade via apt
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
upgrade: dist
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Update & Upgrade - Modern RHEL-based systems (DNF)
|
||||
- name: Update and Upgrade - Rocky Linux
|
||||
hosts: rocky:&reachable_hosts
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Update & Upgrade via dnf
|
||||
ansible.builtin.dnf:
|
||||
name: "*"
|
||||
state: latest
|
||||
update_cache: true
|
||||
when:
|
||||
- ansible_os_family == "RedHat"
|
||||
- ansible_pkg_mgr == "dnf"
|
||||
|
||||
- name: Update & Upgrade - Legacy RHEL-based systems (YUM)
|
||||
ansible.builtin.yum:
|
||||
name: "*"
|
||||
state: latest
|
||||
update_cache: true
|
||||
when:
|
||||
- ansible_os_family == "RedHat"
|
||||
- ansible_pkg_mgr == "yum"
|
||||
update_cache: true
|
||||
Reference in New Issue
Block a user