Here are three separate ways of using Ansible to perform system upgrades on an Ubuntu based system.
apt-update-upgrade.yml
This is the absolute most basic playbook I use. It performs anapt update
, thenapt full-upgrade
and lastly anapt autoremove
andapt autoclean
.apt-update-upgrade-only-once-a-day.yml
I use this in playbook where I'm repeatedly running it to do installs or reconfiguration, or where I haveunattended-upgrades
installed.apt-update-upgrade-with-check.yml
On systems where I'm not the only administrator, I don't always know whether I'll want to apply an upgrade, so this gives me a chance to list off what packages will be updated