2

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.

cherouvim
  • 744
  • 3
  • 18
  • 37

1 Answers1

2

That dialog comes from the UCF framework, which attempts to be a bit smarter about configuration files than dpkg's regular config file handling.

According to the manual page for ucf you can set an environment variable UCF_FORCE_CONFFNEW to instruct it to always overwrite the configuration file.

That is different from using dpkg --force-confnew though, because it only applies to packages using UCF.

Simon Richter
  • 3,209
  • 17
  • 17