create playbook to apply updates to all managed hosts
This commit is contained in:
@@ -16,10 +16,12 @@
|
||||
file: path=~/.ssh state=directory mode=700
|
||||
|
||||
- debug: var=ansible_os_family
|
||||
run_once: true
|
||||
|
||||
- debug: var=ansible_architecture
|
||||
run_once: true
|
||||
|
||||
- debug: var=ansible_distribution_release
|
||||
|
||||
- debug: var=ansible_pkg_mgr
|
||||
|
||||
tasks:
|
||||
- name: ping
|
||||
|
||||
29
ansible-5/playbooks/update_managed.yaml
Normal file
29
ansible-5/playbooks/update_managed.yaml
Normal 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
|
||||
Reference in New Issue
Block a user