22 lines
1.0 KiB
YAML
22 lines
1.0 KiB
YAML
# Path: main/update-apt-packages.pb.yml
|
|
---
|
|
|
|
- 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 # 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 # 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"] |