diff --git a/.gitignore b/.gitignore index dbe9c82..87287e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.vscode/ \ No newline at end of file +.vscode/ +Ansible/secrets.yml +Ansible/inventory/hosts.ini \ No newline at end of file diff --git a/Ansible/apt_upgrade.yml b/Ansible/apt_upgrade.yml index ba32fda..e11acf1 100644 --- a/Ansible/apt_upgrade.yml +++ b/Ansible/apt_upgrade.yml @@ -3,12 +3,22 @@ become: true tasks: - - name: Update cache + - name: Update apt cache ansible.builtin.apt: update_cache: true register: cache_updated - - name: Upgrade packages if something is changed + - name: Upgrade all packages ansible.builtin.apt: upgrade: "yes" - when: cache_updated.changed \ No newline at end of file + when: cache_updated.changed or cache_updated.rc == 0 + + - name: Autoremove unnecessary packages + ansible.builtin.apt: + autoremove: true + when: cache_updated.changed or cache_updated.rc == 0 + + - name: Autoclean apt cache + ansible.builtin.apt: + autoclean: true + when: cache_updated.changed or cache_updated.rc == 0 \ No newline at end of file diff --git a/Ansible/hosts.ini b/Ansible/hosts.ini new file mode 100644 index 0000000..e69de29