mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-06-27 12:45:32 +02:00
65 lines
2.1 KiB
YAML
65 lines
2.1 KiB
YAML
---
|
|
- name: "include docker-central-database"
|
|
include_role:
|
|
name: docker-central-database
|
|
|
|
- name: "include role nginx-domain-setup for {{application_id}}"
|
|
include_role:
|
|
name: nginx-domain-setup
|
|
vars:
|
|
domain: "{{ domains | get_domain(application_id) }}"
|
|
http_port: "{{ ports.localhost.http[application_id] }}"
|
|
|
|
- include_tasks: "{{ playbook_dir }}/roles/docker-compose/tasks/create-files.yml"
|
|
|
|
- name: Wait for Gitea HTTP endpoint
|
|
wait_for:
|
|
host: "127.0.0.1"
|
|
port: "{{ ports.localhost.http[application_id] }}"
|
|
delay: 5
|
|
timeout: 300
|
|
|
|
- name: "Run DB migrations inside Gitea container"
|
|
shell: |
|
|
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
|
exec -T --user git application \
|
|
/app/gitea/gitea migrate
|
|
args:
|
|
chdir: "{{ docker_compose.directories.instance }}"
|
|
register: migrate
|
|
changed_when: "'migrations completed' in migrate.stdout"
|
|
|
|
- name: "Create initial admin user"
|
|
shell: |
|
|
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
|
exec -T --user git application \
|
|
/app/gitea/gitea admin user create \
|
|
--admin \
|
|
--username "{{ users.administrator.username }}" \
|
|
--password "{{ users.administrator.password }}" \
|
|
--email "{{ users.administrator.email }}" \
|
|
-c /data/gitea/conf/app.ini
|
|
args:
|
|
chdir: "{{ docker_compose.directories.instance }}"
|
|
register: create_admin
|
|
changed_when: "'has been successfully created' in create_admin.stdout"
|
|
failed_when: create_admin.rc != 0 and 'user already exists' not in create_admin.stderr
|
|
|
|
- name: "Wait until Gitea setup and migrations are ready"
|
|
uri:
|
|
url: "http://127.0.0.1:{{ ports.localhost.http[application_id] }}/api/v1/version"
|
|
method: GET
|
|
status_code: 200
|
|
return_content: no
|
|
register: gitea_ready
|
|
until: gitea_ready.status == 200
|
|
retries: 20
|
|
delay: 5
|
|
when: applications | is_feature_enabled('oidc', application_id) or applications | is_feature_enabled('ldap', application_id)
|
|
|
|
- name: Execute Setup Routines
|
|
include_tasks: setup.yml
|
|
|
|
- name: Execute Cleanup Routines
|
|
include_tasks: cleanup.yml
|
|
when: mode_cleanup |