diff --git a/tasks/main.yml b/tasks/main.yml index 4e96945..c5d75cc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -42,29 +42,30 @@ when: arch.stdout - name: Upgrade system for arch - pacman: - state: latest # not required. choices: absent;latest;present. Desired state of the package. - upgrade: true # not required. Whether or not to upgrade whole system. - force: true # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. + community.general.pacman: + state: latest + upgrade: true + force: true update_cache: true become: true register: upgrade_arch when: arch.stdout - name: Upgrade system for debian - apt: - update_cache: yes # not required. Run the equivalent of C(apt-get update) before the operation. Can be run as part of the package installation or as a separate step. - only_upgrade: yes # not required. Only upgrade a package if it is already installed. - upgrade: full # not required. choices: dist;full;no;safe;yes. If yes or safe, performs an aptitude safe-upgrade.,If full, performs an aptitude full-upgrade.,If dist, performs an apt-get dist-upgrade.,Note: This does not upgrade a specific package, use state=latest for that.,Note: Since 2.4, apt-get is used as a fall-back if aptitude is not present. - state: latest # not required. choices: absent;build-dep;latest;present. Indicates the desired package state. C(latest) ensures that the latest version is installed. C(build-dep) ensures the package build dependencies are installed. + ansible.builtin.apt: + update_cache: true + only_upgrade: true + upgrade: full become: true when: debian.stdout register: upgrade_debian - name: Reboot updates to apply - reboot: + ansible.builtin.reboot: reboot_timeout: 3600 - when: (arch.stdout and (upgrade_arch.changed and "linux" in upgrade_arch.packages)) or (debian.stdout and upgrade_debian.changed) + when: + (arch.stdout and (upgrade_arch.changed and upgrade_arch.packages is defined and "linux" in upgrade_arch.packages)) + or (debian.stdout and upgrade_debian.changed) become: true - name: Collect only selected facts