How to keep configuration files automatically during apt-get upgrade or install? When performing and apt-get update; apt-get upgrade -y on a server I encountered the message:

Setting up sudo (1.8.16-0ubuntu1.5) ...

Configuration file '/etc/sudoers'
==&gt; Modified (by you or by a script) since installation.
==&gt; Package distributor has shipped an updated version.
What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
The default action is to keep your current version.
*** sudoers (Y/I/N/O/D/Z) [default=N] ?
Setting up ubuntu-minimal (1.361.1) ...


I know that debconf can be used to configure packages, like MySQL, to answer questions to prompts.

Which Linux Program/Module/Function/etc should I use to prepare an answer to this prompt? 

I would really like to know a solution that be performed via Ansilbe if one exists. In addition to a BASH script.

Please note: ALL my distributions are done via IaC and thus automation is critical.
There are options you can pass through apt-get to dpkg that will handle the config choices. We usually do something like:

apt-get install -y --no_install_recommends -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' &lt;package_name&gt;

When using ansible you can do:

  apt:
    pkg: "{{ item }}"
    only_upgrade: yes
    install_recommends: no
    force: yes
    dpkg_options: 'force-confdef,force-confold'
    state: latest
  with_items:
    - &lt;package_name&gt;


For further details on the ansible apt module options look here