From e49b2bfb9953e7cfeff62aafc43659a650dfcf56 Mon Sep 17 00:00:00 2001 From: Erik Stambaugh Date: Mon, 22 Jan 2024 20:06:49 -0800 Subject: [PATCH] Fix admin email for owner user and fix psql schema check --- ansible/roles/mastodon/tasks/main.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ansible/roles/mastodon/tasks/main.yaml b/ansible/roles/mastodon/tasks/main.yaml index 6f01175..f73d60b 100644 --- a/ansible/roles/mastodon/tasks/main.yaml +++ b/ansible/roles/mastodon/tasks/main.yaml @@ -128,7 +128,9 @@ # or https://docs.joinmastodon.org/admin/tootctl/#accounts-create - 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 - name: initialize mastodon database @@ -136,14 +138,14 @@ args: chdir: /srv/mastodon when: hazschema.stdout is match("Did not find any relations") - + register: newschema - 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'" + 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" @@ -151,7 +153,7 @@ command: docker compose restart args: chdir: /srv/mastodon - when: envfile.changed or compose.changed + when: envfile.changed or compose.changed or newschema.changed ## add nginx config