From 9056a38e4bc8ebddecf86b5bb76f0860cd339975 Mon Sep 17 00:00:00 2001 From: c0de Date: Wed, 3 Jan 2024 23:56:04 -0600 Subject: [PATCH] Create playbook and role to update system --- ansible/00-install-updates.yml | 9 +++++++++ .../roles/apt-update-system/tasks/main.yml | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 ansible/00-install-updates.yml create mode 100644 ansible/roles/apt-update-system/tasks/main.yml diff --git a/ansible/00-install-updates.yml b/ansible/00-install-updates.yml new file mode 100644 index 0000000..2b9007a --- /dev/null +++ b/ansible/00-install-updates.yml @@ -0,0 +1,9 @@ +--- + +- name: Update the system + hosts: pibox + become: true + roles: + - role: apt-update-system + +... diff --git a/ansible/roles/apt-update-system/tasks/main.yml b/ansible/roles/apt-update-system/tasks/main.yml new file mode 100644 index 0000000..b0727c3 --- /dev/null +++ b/ansible/roles/apt-update-system/tasks/main.yml @@ -0,0 +1,19 @@ +--- + +- name: update the installed packages + ansible.builtin.apt: + update_cache: true + name: "*" + state: latest + +- name: update the operating system + ansible.builtin.apt: + upgrade: dist + +- name: clean up apt cache + ansible.builtin.apt: + autoclean: true + autoremove: true + purge: true + +...