Create admin account automatically

This commit is contained in:
Erik Stambaugh 2024-01-21 12:27:46 -08:00
parent 716d0f1dc8
commit 5124a8035f

View file

@ -137,6 +137,16 @@
chdir: /srv/mastodon chdir: /srv/mastodon
when: hazschema.stdout is match("Did not find any relations") when: hazschema.stdout is match("Did not find any relations")
- name: check whether our admin account has been created yet
shell: "docker exec -t mastodon_db psql -U postgres mastodon_production -t -c 'select count(*) from accounts;' | awk '{ print $1 }' | head -1"
register: accountcount
- name: create admin account
command: "docker exec -it mastodon_web bash -c 'RAILS_ENV=production tootctl accounts create meat --email meat@{{ domain_name }} --confirmed --role Owner'"
when: accountcount.stdout == "1"
- name: restart mastodon - name: restart mastodon
command: docker compose restart command: docker compose restart
args: args: