fix: upgrade reboot condition

This commit is contained in:
vincent 2023-08-25 09:00:38 +02:00
parent 3c007c58df
commit 7e7c25c7af

View File

@ -42,29 +42,30 @@
when: arch.stdout when: arch.stdout
- name: Upgrade system for arch - name: Upgrade system for arch
pacman: community.general.pacman:
state: latest # not required. choices: absent;latest;present. Desired state of the package. state: latest
upgrade: true # not required. Whether or not to upgrade whole system. upgrade: true
force: true # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. force: true
update_cache: true update_cache: true
become: true become: true
register: upgrade_arch register: upgrade_arch
when: arch.stdout when: arch.stdout
- name: Upgrade system for debian - name: Upgrade system for debian
apt: ansible.builtin.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. update_cache: true
only_upgrade: yes # not required. Only upgrade a package if it is already installed. only_upgrade: true
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. upgrade: full
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.
become: true become: true
when: debian.stdout when: debian.stdout
register: upgrade_debian register: upgrade_debian
- name: Reboot updates to apply - name: Reboot updates to apply
reboot: ansible.builtin.reboot:
reboot_timeout: 3600 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 become: true
- name: Collect only selected facts - name: Collect only selected facts