Update All the Things

Do you ever just update everything?

There’s a few times you might need to do this. For example, some nasty vulnerability comes along and ruins your week.

Or maybe you just want to be super up to date because you have a strange compulsion to have the latest and greatest of everything. Ether way, here’s my solution:

Use Ansible inventories to update all your servers

I wrote this playbook as a simple way to ‘freshen up’ my homelab after months of neglect. In essence, it will apply all available updates for all the hosts in the defined inventory.

After updating each box, it logs all the package updates to a file in the update_logs subdirectory with the date and hostname.

Finally, it will check the if a reboot-required file exists and, as long as the server is a VM, restart it.

Running the script is simple:

ansible-playbook -i inventories/my-environment update.yml 

Try it out: