Skip notification prompt for newlist command

Mailman's newlist command helpfully prompts on the TTY waiting for
the user to press enter so that a message will be sent to the list
admin containing the initial configuration password or ctrl-C to
abort notifying. Unfortunately, Ansible's command tasks look enough
like an interactive TTY to confuse newlist into thinking it should
do the same when orchestrated. Pass an empty stdin as part of the
task to work around this.

We didn't encounter the issue in our test jobs, because we avoid
sending notifications by passing newlist a --quiet option which
skips that step, and thus the problematic prompting behavior we
observed in production deployment.

Change-Id: I345bda61802f93a52386b7d3057163e30f0e1b65
This commit is contained in:
Jeremy Stanley 2021-08-02 20:49:19 +00:00 committed by Clark Boylan
parent 47d1737cd7
commit bf81097a85

View File

@ -14,7 +14,9 @@
MAILMAN_SITE_DIR: "{{ mm_site_root }}"
register: listlists
- name: Create the site list if it doesn't exist
command: "newlist {% if mailman_test_mode is defined and mailman_test_mode %} -q {% endif %} {{ mm_list_name }} {{ mm_list_admin }} {{ mm_list_password }}"
command:
cmd: "newlist {% if mailman_test_mode is defined and mailman_test_mode %} -q {% endif %} {{ mm_list_name }} {{ mm_list_admin }} {{ mm_list_password }}"
stdin: ''
environment:
MAILMAN_SITE_DIR: "{{ mm_site_root }}"
when:
@ -27,7 +29,9 @@
command: list_lists --bare
register: listlists
- name: Create the list if it doesn't exist
command: "newlist {% if mailman_test_mode is defined and mailman_test_mode %} -q {% endif %} {{ mm_list_name }} {{ mm_list_admin }} {{ mm_list_password }}"
command:
cmd: "newlist {% if mailman_test_mode is defined and mailman_test_mode %} -q {% endif %} {{ mm_list_name }} {{ mm_list_admin }} {{ mm_list_password }}"
stdin: ''
when:
- ( listlists.stdout_lines | intersect([ mm_list_name ]) | length | int ) == 0
when: mm_site_name == "_default"