#StackBounty: #ubuntu #ansible #upgrade #dpkg How to force ansible apt upgrade to install new configuration files (force-confnew)

Bounty: 50

I have an Ubuntu 18 LTS host which I want to upgrade via ansible and force apt-get dist-upgrade to install any new configurations available overwriting any existing ones, as if I was there pressing the first option of that dialog:
apt-get dist-upgrade dialog

I’m looking into the ansible apt_module documentation and cannot get this to work. In all cases my touched configurations are maintained, and the new vendor ones are stored in .ucf-dist files.

So far I’ve tried:

# 1:
ansible -i my-hosts foo -m apt -a 'update_cache=yes upgrade=safe dpkg_options=force-confnew'

# 2:
ansible -i my-hosts foo -m apt -a 'force_apt_get=yes update_cache=yes upgrade=safe dpkg_options=force-confnew'

# 3:
ansible -i my-hosts foo -m apt -a 'force_apt_get=yes update_cache=yes upgrade=dist dpkg_options=force-confnew'

FYI I reproduce this locally with VirtualBox snapshots where I revert after every test.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.