From 33faf8b1883e31181585f4d0e8246c80b64f3851 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Tue, 19 Dec 2023 10:55:47 +0100 Subject: [PATCH] add update-playbook (#631) Reviewed-on: https://git.mgrote.net/mg/homeserver/pulls/631 Co-authored-by: Michael Grote Co-committed-by: Michael Grote --- playbooks/on-off/update.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 playbooks/on-off/update.yml diff --git a/playbooks/on-off/update.yml b/playbooks/on-off/update.yml new file mode 100644 index 00000000..e1da650d --- /dev/null +++ b/playbooks/on-off/update.yml @@ -0,0 +1,21 @@ +--- +- hosts: all + become: true + tasks: + - name: update apt cache + ansible.builtin.apt: + update_cache: true + + - name: update installed packages + ansible.builtin.package: + upgrade: dist + register: upgrade + + - name: apt autoremove + ansible.builtin.apt: + autoremove: true + clean: yes + + - name: reboot + ansible.builtin.reboot: + when: (upgrade.changed and (inventory_hostname != 'pve5.mgrote.net' and inventory_hostname != 'ansible2.mgrote.net'))