📖 DOC:

This commit is contained in:
Yuri Lima
2023-09-07 15:38:56 +01:00
parent 4549d7ccf2
commit 718b4de6b0
4 changed files with 55 additions and 11 deletions

View File

@@ -1,21 +1,22 @@
# Path: main/update-apt-packages.pb.yml
---
- hosts: ["main_server"]
become: yes
- hosts: ["devGroup"]
become: yes # Run tasks as root like sudo
tasks:
- name: Update Repository Index [apt update]
tags: ["update-apt-packages"]
package:
update_cache: yes
cache_valid_time: 3600
register: apt_update
update_cache: yes # Same as apt-get update
cache_valid_time: 3600 # Cache is valid for 1 hour
register: apt_update # Register the output of the task
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]
- name: Upgrade Dist[apt upgrade]
tags: ["upgrade-apt-packages"]
package:
upgrade: dist
force_apt_get: yes
autoremove: yes
autoclean: yes
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]
upgrade: dist # Same as apt-get dist-upgrade
force_apt_get: yes # Force apt-get instead of apt
autoremove: yes # Same as apt-get autoremove, remove unused dependency packages for all module states except build-dep
autoclean: yes # Same as apt-get autoclean, cleans the local repository of retrieved package files that can no longer be downloaded
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]