add update-playbook (#631)

Reviewed-on: #631
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
This commit is contained in:
Michael Grote 2023-12-19 10:55:47 +01:00 committed by mg
parent bc754e8b42
commit 33faf8b188
1 changed files with 21 additions and 0 deletions

View File

@ -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'))