This blog post will show how to check which updates are available on managed Ubuntu servers using Ansible.
In the previous blog post on the topic, I have shown how to check disk space on multiple machines using the Ansible register option. This post will utilize the same concept and will use the register command.
Playbook
The following playbook will run the apt list command on each Ubuntu server in the inventory and output the result to the console using the debug command.
--- - hosts: servers tasks: - name: apt: update_cache: yes - name: command: apt list --upgradable register: updates - debug: var=updates.stdout_lines
For more Ansible articles visit the main category page.
Processing…
Success! You're on the list.
Whoops! There was an error and we couldn't process your subscription. Please reload the page and try again.