Added administrator account creation for mastodon

This commit is contained in:
Kevin Veen-Birkenbach 2025-02-22 12:12:15 +01:00
parent 8b072c0ed2
commit c2975262ea
3 changed files with 18 additions and 2 deletions

View File

@ -54,7 +54,7 @@ defaults_redirect_domain_mappings:
- { source: "gitea.{{primary_domain}}", target: "{{domains.gitea}}" }
- { source: "keycloak.{{primary_domain}}", target: "{{domains.keycloak}}" }
- { source: "listmonk.{{primary_domain}}", target: "{{domains.listmonk}}" }
- { source: "mail.{{primary_domain}}", target: "{{domains.mailu}}" }
- { source: "mailu.{{primary_domain}}", target: "{{domains.mailu}}" }
- { source: "moodle.{{primary_domain}}", target: "{{domains.moodle}}" }
- { source: "nextcloud.{{primary_domain}}", target: "{{domains.nextcloud}}" }
- { source: "openproject.{{primary_domain}}", target: "{{domains.openproject}}" }

View File

@ -0,0 +1,13 @@
# Routines to create the administrator account
# @see https://chatgpt.com/share/67b9b12c-064c-800f-9354-8e42e6459764
- name: Remove line containing "- administrator" from config/settings.yml to allow creating administrator account
shell: docker compose exec -u root web sed -i '/- administrator/d' config/settings.yml
when: administrator_username == "administrator"
- name: Create admin account via tootctl
shell: 'docker compose exec -u root web bash -c "RAILS_ENV=production bin/tootctl accounts create {{administrator_username}} --email {{administrator_email}} --confirmed --role Owner"'
ignore_errors: true
- name: Approve the administrator account in Mastodon
shell: docker compose exec -u root web bash -c "RAILS_ENV=production bin/tootctl accounts modify {{administrator_username}} --approve"

View File

@ -22,4 +22,7 @@
command:
cmd: "docker-compose run --rm web bundle exec rails db:migrate"
chdir: "{{docker_compose.directories.instance}}"
when: applications.mastodon.setup |bool
when: applications.mastodon.setup |bool
- name: "include create-administrator.yml for mastodon"
include_tasks: create-administrator.yml