[mailman3] Add django superuser creation task

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
This commit is contained in:
Michal Konecny 2024-04-19 12:27:31 +02:00
parent d4fba9fd55
commit 4c7885c89d
3 changed files with 27 additions and 0 deletions

View file

@ -112,6 +112,7 @@
mailman_openidc_secret: "{{ mailman_stg_oidc_pass }}"
mailman_httpd_hostname: lists.stg.fedoraproject.org
mailman_openidc_client_id: "mailman3{{ env_suffix }}"
mailman_hyperkitty_su_pass: "{{ mailman_stg_hk_su_pass }}"
when: env == "staging"
- {role: fedmsg/base,
when: env != "staging"}

View file

@ -27,6 +27,9 @@ mailman_hyperkitty_admin_db_pass: changeme
mailman_hyperkitty_db_pass: changeme
mailman_hyperkitty_cookie_key: changeme
mailman_hyperkitty_archiver_key: changeme
mailman_hyperkitty_su_username: mailman
mailman_hyperkitty_su_email: admin@fedoraproject.org
mailman_hyperkitty_su_pass: changeme
mailman_gunicorn_workers: 4
mailman_domains:
- lists.example.com

View file

@ -320,6 +320,29 @@
notify:
- reload mailmanweb
- name: Create superuser for django-admin
ansible.builtin.command:
cmd: mailman-web createsuperuser --username "{{ mailman_hyperkitty_su_username }}" --no-input --email "{{ mailman_hyperkitty_su_email }}"
become_user: mailman
register: command_result
tags:
- mailman
- hyperkitty
# Ignore error when the username already exists
failed_when:
- "'That username is already taken.' not in command_result.stderr"
- "command_result.rc != 0"
- name: Change superuser password
ansible.builtin.expect:
command: mailman-web changepassword {{ mailman_hyperkitty_su_username }}
responses:
- 'Password:' : {{ mailman_hyperkitty_su_pass }}
become_user: mailman
tags:
- mailman
- hyperkitty
#
# Plug HyperKitty into Mailman
#