diff --git a/inventory/lab/inventory.yml b/inventory/lab/inventory.yml index 1c10a3f..d24ebf9 100644 --- a/inventory/lab/inventory.yml +++ b/inventory/lab/inventory.yml @@ -13,6 +13,3 @@ all: ubu24: ansible_host: 127.0.0.1 ansible_port: 2223 - alma9: - ansible_host: 127.0.0.1 - ansible_port: 2222 diff --git a/playbooks/patching.yml b/playbooks/patching.yml new file mode 100644 index 0000000..7a8ea88 --- /dev/null +++ b/playbooks/patching.yml @@ -0,0 +1,9 @@ +--- +- name: Patch Linux servers + hosts: + - all + become: true + + roles: + - patching + diff --git a/playbooks/webservers.yml b/playbooks/webservers.yml deleted file mode 100644 index 50f35ad..0000000 --- a/playbooks/webservers.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Configure webserver with nginx - hosts: - - aton - become: true - - roles: - - nginx diff --git a/roles/patching/handlers/main.yml b/roles/patching/handlers/main.yml new file mode 100644 index 0000000..2b6aca9 --- /dev/null +++ b/roles/patching/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: Reboot if required + ansible.builtin.reboot: + reboot_timeout: 600 diff --git a/roles/patching/tasks/main.yml b/roles/patching/tasks/main.yml new file mode 100644 index 0000000..7611cac --- /dev/null +++ b/roles/patching/tasks/main.yml @@ -0,0 +1,10 @@ +--- +- name: Patch Debian-family hosts + ansible.builtin.apt: + state: present + update_cache: yes + upgrade: safe + autoremove: yes + autoclean: yes + when: ansible_os_family == 'Debian' + notify: Reboot if required