jnv / ansible-role-unattended-upgrades

[DEPRECATED] Setup unattended-upgrades on Debian-based systems
https://github.com/jnv/ansible-role-unattended-upgrades/issues/98
GNU General Public License v2.0
272 stars 94 forks source link

Permit adding additional Dpkg::Options #39

Closed conorsch closed 6 years ago

conorsch commented 7 years ago

Lately I've observed a few upgrades failing due to modified config files in /etc/. What I'd like to do is force keeping the customized config files, which is possible via dpkg options, but the role does not support appending any additional options to the unattended-upgrades config.

See here for an example implementation: https://github.com/jlund/streisand/commit/24de9b96f421e5874e9b3abbe4b08b5ebead9f0c

I propose adding a new role var called unattended_dpkg_options and set it to an empty list. Users of the role can then override that var to enable upgrades of packages with modified config files, e.g.:

unattended_dpkg_options:
  - "--force-confdef"
  - "--force-confold"

Then we can loop over that list var in the existing templates/unattended-upgrades.j2 and write out any options. By default, the role behavior would not change. I'm amenable to setting the above vars as the default var values (strikes me as a sane default), but mostly I just want override capability.

@jnv If you agree, please assign issue to me and I'm happy to put together a PR.

jnv commented 7 years ago

Hi Conor, thanks for the suggestion! I agree, although as far as I understand the APT conffiles, these options will affect also the regular interactive use of apt, so this has to be communicated clearly. On the other hand, unattended-upgrades have explicit support for this, so it makes sense to expose it through the configuration variable as opt-in.

Feel free to send PR for this.

jnv commented 6 years ago

Merged in #41