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 and upgraded when I let it proceed... or perhaps I just want a list of what's going to change first! To run this, I also need to create a directory in the same path calledfilter_plugins
and need to put the filesplitpart.py
in there (that's from https://www.redpill-linpro.com/sysadvent/2017/12/24/ansible-system-updates.html).
Anyway, I use these in different places for different purposes, so I hope they help you!