How to write Ansible YAML for tasks done using dpkg-reconfigure command that ask question during the process?
dpkg-reconfigure
Example
sudo dpkg-reconfigure slapd
I was trying to write an Ansible playbook to automate reconfiguring slapd with default values.
slapd
Since Ansible is mainly a Configuration Management Tool with which one declared a Desired State, a Version Control System should be used in general, a non-interactive approach should be the main goal and any interaction should be prevented.
To do so, the within the comments mentioned debconf module – Configure a .deb package could come in place and which can then be used like in How do I make Ansible actually compile a config file having changed my debconf settings for an application?.
debconf
Further Similar Q&A
dpkg-reconfigure openssh-server
dpkg-reconfigure dash
bash
Since Ansible is mainly a Configuration Management Tool with which one declared a Desired State, a Version Control System should be used in general, a non-interactive approach should be the main goal and any interaction should be prevented.
To do so, the within the comments mentioned
debconfmodule – Configure a .deb package could come in place and which can then be used like in How do I make Ansible actually compile a config file having changed mydebconfsettings for an application?.Further Similar Q&A
dpkg-reconfigure openssh-serverin Ansible playbookdpkg-reconfigure dashasbashautomatically?dpkg-reconfigurein a non-interactive way