From 154a71d6fe1b9cb1b7af98938884bb78b845ea1f Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Tue, 30 Aug 2022 07:29:39 -0500 Subject: [PATCH] Add update and reboot playbooks --- playbooks/reboot.yaml | 9 +++++++++ playbooks/update.yaml | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 playbooks/reboot.yaml create mode 100644 playbooks/update.yaml diff --git a/playbooks/reboot.yaml b/playbooks/reboot.yaml new file mode 100644 index 0000000..c7261e6 --- /dev/null +++ b/playbooks/reboot.yaml @@ -0,0 +1,9 @@ +--- +- name: reboot all servers + hosts: all + serial: 1 + tasks: + - name: Reboot + reboot: + - name: Wait for system to become reachable + wait_for_connection: diff --git a/playbooks/update.yaml b/playbooks/update.yaml new file mode 100644 index 0000000..4650c1f --- /dev/null +++ b/playbooks/update.yaml @@ -0,0 +1,18 @@ +--- +- name: update all servers + become: true + hosts: all + tasks: + - name: Upgrade the OS (apt) + apt: + update_cache: true + upgrade: dist + when: ansible_pkg_mgr == 'apt' + + - name: Upgrade the OS (dnf) + dnf: + name: '*' + state: latest + update_cache: yes + update_only: yes + when: ansible_pkg_mgr == 'dnf'