/home/zuul/src/opendev.org/opendev/system-config/playbooks/service-lists3.yaml
Execution
Date 08 Apr 2026 21:37:16 +0000
Duration 00:03:38.72
Controller bridge99.opendev.org
User root
Versions
Ansible 2.15.13
ara 1.7.5 / 1.7.5
Python 3.10.12
Summary
1 Hosts
161 Tasks
159 Results
1 Plays
21 Files
0 Records

File: /home/zuul/src/opendev.org/opendev/system-config/playbooks/roles/mailman3/tasks/create_lists.yaml

- name: Check if domain exists
  uri:
    url: 'http://localhost:8001/3.1/domains/{{ mm_site.listdomain }}'
    url_username: restadmin
    url_password: "{{ mailman3_rest_password }}"
    force_basic_auth: yes
    method: GET
    body_format: json
    status_code: [200, 404]
  register: domain_exists
  no_log: true

- name: Create list domain in mm3
  when: domain_exists.status == 404
  uri:
    url: 'http://localhost:8001/3.1/domains'
    url_username: restadmin
    url_password: "{{ mailman3_rest_password }}"
    force_basic_auth: yes
    method: POST
    body_format: json
    body:
      mail_host: "{{ mm_site.listdomain }}"
    status_code: [201]
  no_log: true

- name: Check if list exists
  uri:
    url: 'http://localhost:8001/3.1/lists/{{ mm_list.name }}@{{ mm_site.listdomain }}'
    url_username: restadmin
    url_password: "{{ mailman3_rest_password }}"
    force_basic_auth: yes
    method: GET
    body_format: json
    status_code: [200, 404]
  register: list_exists
  loop: "{{ mm_site.lists }}"
  loop_control:
    loop_var: mm_list
  no_log: true

- name: Create lists in mm3
  when: list_exists.results[exists_idx].status == 404
  uri:
    url: 'http://localhost:8001/3.1/lists'
    url_username: restadmin
    url_password: "{{ mailman3_rest_password }}"
    force_basic_auth: yes
    method: POST
    body_format: json
    body:
      fqdn_listname: "{{ mm_list.name }}@{{ mm_site.listdomain }}"
      style_name: "{{ mm_list.private | default('false') | bool | ternary('private-default', 'legacy-default') }}"
    status_code: [201]
  loop: "{{ mm_site.lists }}"
  loop_control:
    loop_var: mm_list
    index_var: exists_idx
  no_log: true

- name: Set list properties in mm3
  when: list_exists.results[exists_idx].status == 404
  uri:
    url: 'http://localhost:8001/3.1/lists/{{ mm_list.name }}@{{ mm_site.listdomain }}/config'
    url_username: restadmin
    url_password: "{{ mailman3_rest_password }}"
    force_basic_auth: yes
    method: PATCH
    body_format: json
    body:
      description: "{{ mm_list.description }}"
      advertised: "{{ mm_list.private | default('false') | bool | ternary('false', 'true') }}"
      # TODO enable this when lynx is present on the container images
      # convert_html_to_plaintext: "true"
      process_bounces: "false"
      filter_extensions:
        - "exe"
        - "bat"
        - "cmd"
        - "com"
        - "pif"
        - "scr"
        - "vbs"
        - "cpl"
      pass_types:
        - "multipart/mixed"
        - "multipart/alternative"
        - "text/plain"
    status_code: [204]
  loop: "{{ mm_site.lists }}"
  loop_control:
    loop_var: mm_list
    index_var: exists_idx
  no_log: true

- name: Set list owner in mm3
  when: list_exists.results[exists_idx].status == 404
  uri:
    url: 'http://localhost:8001/3.1/members'
    url_username: restadmin
    url_password: "{{ mailman3_rest_password }}"
    force_basic_auth: yes
    method: POST
    body_format: json
    body:
      list_id: "{{ mm_list.name }}.{{ mm_site.listdomain }}"
      subscriber: "{{ mm_list.owner }}"
      role: "owner"
    status_code: [201]
  loop: "{{ mm_site.lists }}"
  loop_control:
    loop_var: mm_list
    index_var: exists_idx
  no_log: true