diff --git a/ansible/roles/mastodon/tasks/main.yaml b/ansible/roles/mastodon/tasks/main.yaml index 6def033..6f01175 100644 --- a/ansible/roles/mastodon/tasks/main.yaml +++ b/ansible/roles/mastodon/tasks/main.yaml @@ -137,6 +137,16 @@ chdir: /srv/mastodon 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 command: docker compose restart args: