Added cleanup to mastodon

This commit is contained in:
2025-10-12 14:03:28 +02:00
parent 0b86b2f057
commit 0e0b703ccd
5 changed files with 39 additions and 25 deletions

View File

@@ -0,0 +1,23 @@
# 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
command:
cmd: "docker exec -u root {{ MASTODON_CONTAINER }} sed -i '/- administrator/d' config/settings.yml"
when: users.administrator.username == "administrator"
- name: Create admin account via tootctl
command:
cmd: 'docker exec -u root {{ MASTODON_CONTAINER }} bash -c "bin/tootctl accounts create {{users.administrator.username}} --email {{ users.administrator.email }} --confirmed --role Owner"'
register: tootctl_create
changed_when: tootctl_create.rc == 0
failed_when: >
tootctl_create.rc != 0
and
("taken" not in tootctl_create.stderr | lower)
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: Approve the administrator account in Mastodon
command:
cmd: docker exec -u root {{ MASTODON_CONTAINER }} bash -c "bin/tootctl accounts modify {{users.administrator.username}} --approve"
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"