mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Huge role refactoring/cleanup. Other commits will propably follow. Because some bugs will exist. Still important for longrun and also for auto docs/help/slideshow generation
This commit is contained in:
43
roles/web-app-mastodon/tasks/create-administrator.yml
Normal file
43
roles/web-app-mastodon/tasks/create-administrator.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
# 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:
|
||||
- web
|
||||
- streaming
|
||||
- sidekiq
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
|
||||
- name: Remove line containing "- administrator" from config/settings.yml to allow creating administrator account
|
||||
command:
|
||||
cmd: "docker compose exec -u root web sed -i '/- administrator/d' config/settings.yml"
|
||||
chdir: "{{docker_compose.directories.instance}}"
|
||||
when: users.administrator.username == "administrator"
|
||||
|
||||
- name: Create admin account via tootctl
|
||||
command:
|
||||
cmd: 'docker compose exec -u root web bash -c "RAILS_ENV=production bin/tootctl accounts create {{users.administrator.username}} --email {{ users.administrator.email }} --confirmed --role Owner"'
|
||||
chdir: "{{docker_compose.directories.instance}}"
|
||||
register: tootctl_create
|
||||
changed_when: tootctl_create.rc == 0
|
||||
failed_when: >
|
||||
tootctl_create.rc != 0
|
||||
and
|
||||
("taken" not in tootctl_create.stderr | lower)
|
||||
|
||||
- name: Approve the administrator account in Mastodon
|
||||
command:
|
||||
cmd: docker compose exec -u root web bash -c "RAILS_ENV=production bin/tootctl accounts modify {{users.administrator.username}} --approve"
|
||||
chdir: "{{docker_compose.directories.instance}}"
|
30
roles/web-app-mastodon/tasks/main.yml
Normal file
30
roles/web-app-mastodon/tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: "include service-rdbms-central"
|
||||
include_role:
|
||||
name: service-rdbms-central
|
||||
|
||||
- name: "Include setup for domain '{{ domain }}'"
|
||||
include_role:
|
||||
name: webserver-proxy-domain
|
||||
loop: "{{ domains.mastodon }}"
|
||||
loop_control:
|
||||
loop_var: domain
|
||||
vars:
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
ws_path: "/api/v1/streaming"
|
||||
ws_port: "{{ ports.localhost.websocket[application_id] }}"
|
||||
client_max_body_size: "80m"
|
||||
vhost_flavour: "ws_generic"
|
||||
|
||||
- name: flush docker service
|
||||
meta: flush_handlers
|
||||
when: applications.mastodon.setup |bool
|
||||
|
||||
- name: setup routine for mastodon
|
||||
command:
|
||||
cmd: "docker-compose run --rm web bundle exec rails db:migrate"
|
||||
chdir: "{{docker_compose.directories.instance}}"
|
||||
when: applications.mastodon.setup |bool
|
||||
|
||||
- name: "include create-administrator.yml for mastodon"
|
||||
include_tasks: create-administrator.yml
|
Reference in New Issue
Block a user