Save admin password in credentials

This commit is contained in:
Erik Stambaugh 2024-01-26 19:27:41 -08:00
parent a4e2957b19
commit 5eb228c279

View file

@ -149,12 +149,23 @@
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 compose exec -it mastodon_web bash -c 'RAILS_ENV=production tootctl accounts create {{ admin_name }} --email {{ admin_email }} --confirmed --role Owner'"
- name: register a mastodon admin account
block:
- name: create admin account
shell: "docker compose exec -it mastodon_web bash -c 'RAILS_ENV=production tootctl accounts create {{ admin_name }} --email {{ admin_email }} --confirmed --role Owner' 2>&1 | grep \"New password: \" | sed -e 's/.*password: //'"
args:
chdir: /srv/mastodon
when: accountcount.stdout == "1"
register: passwdout
- name: save masto admin password
delegate_to: localhost
become: false
copy:
dest: credentials/mastodon/masto_admin_pw
content: "{{passwdout.stdout}}"
when: accountcount.stdout == "1"
- name: restart mastodon
command: docker compose restart