
This converts our existing puppeted mailman configuration into a set of ansible roles and a new playbook. We don't try to do anything new and instead do our best to map from puppet to ansible as closely as possible. This helps reduce churn and will help us find problems more quickly if they happen. Followups will further cleanup the puppetry. Change-Id: If8cdb1164c9000438d1977d8965a92ca8eebe4df
36 lines
1.4 KiB
YAML
36 lines
1.4 KiB
YAML
# The bulk of this role can likely be replaced with:
|
|
# https://github.com/CCI-MOC/moc-ansible-mailman
|
|
# Just a note for possible future improvement.
|
|
|
|
- name: Block for multihost lists
|
|
block:
|
|
- name: Set mailman site root fact
|
|
set_fact:
|
|
mm_site_root: "/srv/mailman/{{ mm_site_name }}"
|
|
cacheable: no
|
|
- name: Check if the site list exists
|
|
command: list_lists --bare
|
|
environment:
|
|
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 }}"
|
|
environment:
|
|
MAILMAN_SITE_DIR: "{{ mm_site_root }}"
|
|
when:
|
|
- ( listlists.stdout_lines | intersect([ mm_list_name ]) | length | int ) == 0
|
|
when: mm_site_name != "_default"
|
|
|
|
- name: Block for normal lists
|
|
block:
|
|
- name: Check if the list exists
|
|
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 }}"
|
|
when:
|
|
- ( listlists.stdout_lines | intersect([ mm_list_name ]) | length | int ) == 0
|
|
when: mm_site_name == "_default"
|
|
|
|
# TODO we accept a description parameter but don't do anything with it
|