Jack Moore

Email: jack(at)jmoore53.com
Project Updates

List Packages to be installed with APT with Ansible Task

31 Jan 2024 » code, infrastructure, docker

Managing system updates across multiple servers can be a complex task, especially when dealing with different packages and updates. This blog post shows how to use Ansible to list upgradable packages on systems using APT, and how to parse this information into a formatted output.

How to List Upgradable Packages with Ansible

Here’s an example Ansible task that lists all upgradable packages using APT:

---
- name: List System Upgrades
  become: true
  become_user: root
  become_method: sudo
  shell: apt list --upgradable
  register: output
- debug: msg=""

Potential Solutions for Managing Upgrade Listings

Moving forward this is how I want the output to show, but for now the playbook output is good enough.

[common-among all servers]
package-1
package-2
package-3
package-4

[server-1]
package-custom

[server-2]
package-custom

Conclusion

By creating a formatted list of upgradable packages, this allows me to better manage and apply updates. This method provides a clear overview of what needs to be updated and allows for better planning of system upgrades.

© Jack Moore - This site was last built Fri 30 Aug 2024 12:31:24 PM EDT