Verified Commit 3c36760a authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Create hyperkitty superuser

parent 099f0b53
$ANSIBLE_VAULT;1.1;AES256
65313234623339323864356538373630656239636266333537366366393135343637303362626439
3561313835643632386364346137643231623535303066380a616338623831646265333136623365
38366435306132633461386463656432383565323339386537636465376330353432663561653063
6163613630663034340a323836356333306263373661396636386261636364343238383165333961
35393938353633326433343032373864633732653762316635366137323061623136636137326338
65306338303531313439383338363132653465336164643465313436376537313033363030326165
666631336636303331323731346630643136
65633134383537376232316263656530316464323366363137633262363930663739633337333632
3732633133633466666566353637366234343165623731320a653663646338393037366166623534
39643163623739623634393130333162666330656638343264336163366263643832653966613964
3163386530343835370a396665373839613936313237396139376433616237373535646131616532
62323239643938653435356263626631306666663538373731636236353362333630346165623237
35613238373834633766363730333032653536643834616532356639666133373036386465373066
64633935366435633130396535646362363131396631363739373632626565393563653231636431
63393161666337343836653336303831393133383032653637633138346434646566623935393864
65633837623561353330393161343863666636316362363239333139353066656662343761646537
3737306366306236343565306662623038316138663863626666
# Mailman
mailman_db_user: mailman
# Hyperkitty
hyperkitty_dir: /usr/share/webapps/hyperkitty
hyperkitty_db_user: hyperkitty
hyperkitty_admin_user: hyperkitty
hyperkitty_admin_email: hyperkitty@archlinux.org
......@@ -33,30 +33,56 @@
# TODO: only run when required, ie. hyperkitty package updated
- name: generate a hyperkitty database
command: django-admin migrate --pythonpath /usr/share/webapps/hyperkitty/ --settings settings
command: django-admin migrate --pythonpath {{ hyperkitty_dir }} --settings settings
become: yes
become_user: hyperkitty
become_method: sudo
- name: run collectstatic for hyperkitty
command: django-admin collectstatic --pythonpath /usr/share/webapps/hyperkitty/ --settings settings
command: django-admin collectstatic --pythonpath {{ hyperkitty_dir }} --settings settings --noinput
become: yes
become_user: hyperkitty
become_method: sudo
- name: run compress for hyperkitty
command: django-admin compress --pythonpath /usr/share/webapps/hyperkitty/ --settings settings
command: django-admin compress --pythonpath {{ hyperkitty_dir }} --settings settings
become: yes
become_user: hyperkitty
become_method: sudo
# TODO: run only once
- name: populate the hyperkitty database
command: django-admin loaddata --pythonpath /usr/share/webapps/hyperkitty/ --settings settings first_start
command: django-admin loaddata --pythonpath {{ hyperkitty_dir }} --settings settings first_start
become: yes
become_user: hyperkitty
become_method: sudo
# TODO: run only once
- name: populate the hyperkitty database
command: django-admin loaddata --pythonpath {{ hyperkitty_dir }} --settings settings first_start
become: yes
become_user: hyperkitty
become_method: sudo
- name: check if hyperkitty admin user exists
command: echo "from django.contrib.auth import get_user_model; User = get_user_model(); print(User.objects.filter(username='{{hyperkitty_admin_user}}').count()>0)" | /usr/bin/python ./manage.py shell
args:
chdir: "{{ hyperkitty_dir }}"
become: yes
become_user: hyperkitty
become_method: sudo
register: hyperkitty_superuser_existed
- name: create hyperkitty admin user
command: django-admin createsuperuser --pythonpath {{ hyperkitty_dir }} --settings settings --noinput --username={{ hyperkitty_admin_user }} --email={{ hyperkitty_admin_email }}
environment:
DJANGO_SUPERUSER_PASSWORD: "{{ vault_mailman_hyperkitty_admin_password }}"
become: yes
become_user: hyperkitty
become_method: sudo
when: not hyperkitty_superuser_existed
- name: start and enable mailman core service
service: name="mailman3.service" enabled=yes state=started
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment