Fix admin email for owner user and fix psql schema check

This commit is contained in:
Erik Stambaugh 2024-01-22 20:06:49 -08:00
parent 98a52b8f53
commit e49b2bfb99

View file

@ -128,7 +128,9 @@
# or https://docs.joinmastodon.org/admin/tootctl/#accounts-create # or https://docs.joinmastodon.org/admin/tootctl/#accounts-create
- name: check for any tables at all - name: check for any tables at all
command: docker exec -t mastodon_db psql -U postgres mastodon_production -P pager=off -c '\dt' command: docker compose exec -t mastodon_db psql -U postgres mastodon_production -P pager=off -c '\dt'
args:
chdir: /srv/mastodon
register: hazschema register: hazschema
- name: initialize mastodon database - name: initialize mastodon database
@ -136,14 +138,14 @@
args: args:
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")
register: newschema
- name: check whether our admin account has been created yet - 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" shell: "docker exec -t mastodon_db psql -U postgres mastodon_production -t -c 'select count(*) from accounts;' | awk '{ print $1 }' | head -1"
register: accountcount register: accountcount
- name: create admin account - 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'" command: "docker exec -it mastodon_web bash -c 'RAILS_ENV=production tootctl accounts create meat --email {{ admin_email }} --confirmed --role Owner'"
when: accountcount.stdout == "1" when: accountcount.stdout == "1"
@ -151,7 +153,7 @@
command: docker compose restart command: docker compose restart
args: args:
chdir: /srv/mastodon chdir: /srv/mastodon
when: envfile.changed or compose.changed when: envfile.changed or compose.changed or newschema.changed
## add nginx config ## add nginx config