Rolling Update Debian-like systems - Ansible module apt
Maintaining in a consistent state your fleet of machines is one of the most time-consuming tasks of the System Administrator. I'm going to show you how to perform Rolling Update with Ansible in Debian-like systems with some simple code: Debian, Ubuntu, Linux Mint, MX Linux, Deepin, AntiX, PureOS, Kali Linux, Parrot OS, Devuan, Knoppix, AV Linux Linux
How to perform Rolling Update with Ansible in Debian-like systems?
I’m going to show you a live demo and some simple Ansible code. I’m Luca Berton and welcome to today’s episode of Ansible Pilot
Ansible Rolling Update packages in Debian-like systems
Today we’re talking about rolling updates on Debian-like systems using Ansible module apt.
We already talked about this module for installing packages but we would like to consider another use case.
This module allows you to manage packages with the apt package manager.
- name string
- state string
- update_cache boolean
- upgrade no/safe/full/dist
The parameter list is pretty wide but today we are focus on these four options for our use case.
The “name” parameter could be a package or we could select all the packages of the system with the “*” star symbol.
The state for this case needs to be “latest” so we target the latest version for every package.
The “update_cache” is useful to forces the update of repository metadata before the installation.
Another useful option is “upgrade” with four alternatives:
- default is a no,
- if safe, performs an aptitude safe-upgrade,
- if full, performs an aptitude full-upgrade,
- if dist performs an apt-get dist-upgrade.
Let’s jump in a real-life demo of Rolling Update on Debian-like systems with Ansible Playbook.
--- - name: rolling update demo hosts: all become: true tasks: - name: ensure pkg updated ansible.builtin.apt: name: nginx state: latest update_cache: true
--- - name: rolling update demo hosts: all become: true tasks: - name: ensure system updated ansible.builtin.apt: name: "*" state: latest update_cache: true
code with ❤️ in GitHub
Now you know better how to troubleshoot the most common Ansible error about privilege escalation. Subscribe to the YouTube channel, Medium, Website, Twitter, and Substack to not miss the next episode of the Ansible Pilot.
Learn the Ansible automation technology with some real-life examples in my
My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
Want to keep this project going? Please donate