Add playbook and accompanying role for doing maintenance

This commit is contained in:
June 2023-09-25 02:57:30 +02:00 committed by julian
parent de97436706
commit b295690ad5
3 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,7 @@
- name: Make Sure System Package Are Up-To-Date
hosts: all
roles:
- apt_update_and_upgrade
- name: Run deploy Playbook
ansible.builtin.import_playbook: deploy.yaml

View file

@ -0,0 +1,11 @@
# Role `apt_update_and_upgrade`
This role does an `apt-get update`, `apt-get dist-upgrade` and a potential reboot (if packages got upgraded) on the specified hosts.
## `hosts`
The `hosts` for this role need to be the VMs, which should be updated and upgraded.
## Required Variables
This role doesn't have any required variables.

View file

@ -0,0 +1,15 @@
- name: update, upgrade and potentially reboot
become: true
block:
- name: apt-get update
ansible.builtin.apt:
update-cache: true
- name: apt-get dist-upgrade
ansible.builtin.apt:
upgrade: dist
register: apt_update_and_upgrade__upgrade_result
- name: reboot, after package upgrade
ansible.builtin.reboot:
when: apt_update_and_upgrade__upgrade_result.changed