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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
harwinder
2026-05-16 17:31:29 -04:00
parent 727231821c
commit bec4eeb7c9
5 changed files with 208 additions and 144 deletions
+12 -19
View File
@@ -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