create playbook to apply updates to all managed hosts

This commit is contained in:
2025-08-10 22:29:49 -04:00
parent fa398caeaa
commit 907cfef01b
3 changed files with 34 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ localhost ansible_connection=local
home ansible_ssh_host=192.168.4.11 home ansible_ssh_host=192.168.4.11
cubox-i ansible_ssh_host=192.168.4.12 cubox-i ansible_ssh_host=192.168.4.12
cubox-m ansible_ssh_host=192.168.4.15 cubox-m ansible_ssh_host=192.168.4.15
raspberrypi_tv ansible_ssh_host=192.168.4.43
[ns] [ns]
;home ansible_ssh_host=192.168.4.11 ;home ansible_ssh_host=192.168.4.11

View File

@@ -16,10 +16,12 @@
file: path=~/.ssh state=directory mode=700 file: path=~/.ssh state=directory mode=700
- debug: var=ansible_os_family - debug: var=ansible_os_family
run_once: true
- debug: var=ansible_architecture - debug: var=ansible_architecture
run_once: true
- debug: var=ansible_distribution_release
- debug: var=ansible_pkg_mgr
tasks: tasks:
- name: ping - name: ping

View File

@@ -0,0 +1,29 @@
---
# update the managed host machines
- name: updates
hosts: managed
gather_facts: true
vars:
pre_tasks:
roles:
tasks:
- name: print os version
ansible.builtin.debug:
var: ansible_facts["os_family"]
## ansible_pkg_mgr, ansible_os_family, ansible_distribution
- name: update packages
apt:
name: "*"
state: latest
update_cache: yes
cache_valid_time: 3600
when: ansible_pkg_mgr == "apt"
become: true
## TODO: raspberrypi os should be a full-upgrade