Module apt pass dpkg options

Hello everyone,

I have a quick question/request.
I have just finished rewriting a shell script which was used to

upgrade a given piece of software. Now it’s ansible playbook!

The one piece of functionality that I can’t find and need is to be
able to pass options to the apt-get command and more precisely

the DPkg::Options::

In particular I need to give it the option: “–force-confnew”

The script current does something like this:

apt-get --allow-unauthenticated -o DPkg::Options::=“–force-confnew” install packagename

So is there any way I can pass the -o DPkg::Options::=“–force-confnew” part to the
apt module the way it is right now?

It would be nice to have something like dpkg_options=“” in the apt module and or only options=“” for things like the --allow-unauthenticated.

Thanks,

It seems like currently the apt ansible module hard-codes the following:

DPKG_OPTIONS = '-o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"'

Does it sound reasonable to have a "dpkg_options" parameter which will override the above if present?

The documentation should mention the default ones and say that if specified explicitly it will 
completely overwrite them.

Cheers,


Go ahead and open up a github issue for this, and we’ll consider it.

Thanks!

Thank you James. Appreciated!

I submitted issue https://github.com/ansible/ansible/issues/3955 for this.

Regards,

Rumen Telbizov