mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-24 11:06:24 +02:00
- resources: per-service cpus/mem/pids for mastodon/streaming/sidekiq/redis/db - compose: rename service key to "mastodon" (was: web), set service_name blocks - tasks(01_setup): run rails db:migrate via docker exec (non-tty, login shell) - tasks(02_administrator): healthchecks for 'mastodon', sed with absolute path, tootctl as user 'mastodon' (non-tty), optional re-health wait - env.j2: add RAILS_ENV={{ ENVIRONMENT | default('production') }} - resource.yml.j2: fix get_app_conf path (service_name default spacing) - docs: remove outdated Installation/Administration files Context: https://chatgpt.com/share/68d332a0-ae98-800f-b418-c0d0262eaa2e
44 lines
1.6 KiB
YAML
44 lines
1.6 KiB
YAML
# Routines to create the administrator account
|
|
# @see https://chatgpt.com/share/67b9b12c-064c-800f-9354-8e42e6459764
|
|
|
|
- name: Check health status of '{{ item }}' container
|
|
shell: |
|
|
cid=$(docker compose ps -q {{ item }})
|
|
docker inspect \
|
|
--format '{{ "{{.State.Health.Status}}" }}' \
|
|
$cid
|
|
args:
|
|
chdir: "{{ docker_compose.directories.instance }}"
|
|
register: healthcheck
|
|
retries: 60
|
|
delay: 5
|
|
until: healthcheck.stdout == "healthy"
|
|
loop:
|
|
- mastodon
|
|
- streaming
|
|
- sidekiq
|
|
loop_control:
|
|
label: "{{ item }}"
|
|
changed_when: false
|
|
|
|
- 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 }}" |