I have an Ansible playbook that I use to configure new Linux VMs. I was recently building a new VM with Ubuntu 22.04. The playbook will write some configuration files related to networking and whatnot, and then the final step of the process is to use Ansibles ansible.builtin.package to install all package updates.
- name: "Install updates" become: true ansible.builtin.package: upgrade: "dist" register: res_pkg_updates notify: "reboot system" tags: [ never, updates ] My VM was created from a template I made a few months ago, so the Ubuntu OS had a few packages out of date, which isn't unexpected. The problem is that one of the packages must support or provide the networking functionality. So when the package modules starts the VM on the path of installing updates, the networking daemon is restarted, and the VM gets the new IP that was configured earlier in my playbook. This causes the Ansible task to hang, waiting for a reconnection to a machine that is now at a different IP.
I want to know how to configure my ansible.builtin.package task to install package updates but not restart any services, especially networking.
