Reinstall a package with ansible apt module
Due to an issue with the Ubuntu motd message regarding the changelogs I needed to reinstall the ubuntu-release-upgrader-core deb package on the new vm. The below task will resinstall the package only on those virtual machines that are being deployed for the first time ( ie: in the [newvms] inventory group )
- name: reinstall ubuntu-release-upgrader-core for new machines
ansible.builtin.apt:
name: ubuntu-release-upgrader-core
state: "{{ item }}"
with_items: ['absent', 'present']
when: ansible_os_family == 'Debian' and 'newvms' in group_names