Last active
August 23, 2019 10:05
-
-
Save tomwassenberg/3c00e55627d52d0c948e92a416537341 to your computer and use it in GitHub Desktop.
A combination of Ansible tasks to trigger an apt upgrade, and wait for it to be done. In contrast to simply using the `apt` module, this is compatible with an apt upgrade already in progress. This is useful when you need to run a playbook on a host with `unattended-upgrades` enabled and is booted up on demand. Workaround for https://github.com/a…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: "update all packages" | |
systemd: | |
name: "apt-daily-upgrade.service" | |
state: "started" | |
- name: "check if updating is done" | |
systemd: | |
name: "apt-daily-upgrade.service" | |
state: "stopped" | |
register: "apt_upgrade" | |
check_mode: true | |
until: "apt_upgrade is skipped or apt_upgrade is not changed" | |
retries: 300 | |
delay: 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment