mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 07:18:09 +02:00
Renamed Gitea variables
This commit is contained in:
@@ -4,26 +4,26 @@
|
|||||||
|
|
||||||
- name: Patch Gitea DB host in app.ini
|
- name: Patch Gitea DB host in app.ini
|
||||||
command: >
|
command: >
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }}
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }}
|
||||||
sed -ri "s|^(HOST\s*=\s*).*$|\1{{ database_host }}:{{ database_port }}|" {{ gitea_config }}
|
sed -ri "s|^(HOST\s*=\s*).*$|\1{{ database_host }}:{{ database_port }}|" {{ GITEA_CONFIG }}
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
|
|
||||||
- name: Patch Gitea DB name in app.ini
|
- name: Patch Gitea DB name in app.ini
|
||||||
command: >
|
command: >
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }}
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }}
|
||||||
sed -ri "s|^(NAME\s*=\s*).*$|\1{{ database_name }}|" {{ gitea_config }}
|
sed -ri "s|^(NAME\s*=\s*).*$|\1{{ database_name }}|" {{ GITEA_CONFIG }}
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
|
|
||||||
- name: Patch Gitea DB user in app.ini
|
- name: Patch Gitea DB user in app.ini
|
||||||
command: >
|
command: >
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }}
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }}
|
||||||
sed -ri "s|^(USER\s*=\s*).*$|\1{{ database_username }}|" {{ gitea_config }}
|
sed -ri "s|^(USER\s*=\s*).*$|\1{{ database_username }}|" {{ GITEA_CONFIG }}
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
|
|
||||||
- name: Patch Gitea DB password in app.ini
|
- name: Patch Gitea DB password in app.ini
|
||||||
command: >
|
command: >
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }}
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }}
|
||||||
sed -ri "s|^(PASSWD\s*=\s*).*$|\1{{ database_password }}|" {{ gitea_config }}
|
sed -ri "s|^(PASSWD\s*=\s*).*$|\1{{ database_password }}|" {{ GITEA_CONFIG }}
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
|
|
||||||
- name: "Flush database patches"
|
- name: "Flush database patches"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
- name: "Lookup existing LDAP auth source ID"
|
- name: "Lookup existing LDAP auth source ID"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth list \
|
gitea admin auth list \
|
||||||
| awk -v name="LDAP ({{ PRIMARY_DOMAIN }})" '$0 ~ name {print $1; exit}'
|
| awk -v name="LDAP ({{ PRIMARY_DOMAIN }})" '$0 ~ name {print $1; exit}'
|
||||||
args:
|
args:
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
- name: "Delete existing LDAP auth source if present"
|
- name: "Delete existing LDAP auth source if present"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth delete --id {{ ldap_source_id_raw.stdout }}
|
gitea admin auth delete --id {{ ldap_source_id_raw.stdout }}
|
||||||
args:
|
args:
|
||||||
chdir: "{{ docker_compose.directories.instance }}"
|
chdir: "{{ docker_compose.directories.instance }}"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
- name: "Lookup existing OIDC auth source ID"
|
- name: "Lookup existing OIDC auth source ID"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth list \
|
gitea admin auth list \
|
||||||
| awk -v name="{{ OIDC.BUTTON_TEXT }}" '$0 ~ name {print $1; exit}'
|
| awk -v name="{{ OIDC.BUTTON_TEXT }}" '$0 ~ name {print $1; exit}'
|
||||||
args:
|
args:
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
- name: "Delete existing OIDC auth source if present"
|
- name: "Delete existing OIDC auth source if present"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth delete --id {{ oidc_source_id_raw.stdout }}
|
gitea admin auth delete --id {{ oidc_source_id_raw.stdout }}
|
||||||
args:
|
args:
|
||||||
chdir: "{{ docker_compose.directories.instance }}"
|
chdir: "{{ docker_compose.directories.instance }}"
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
- name: "Run DB migrations inside Gitea container"
|
- name: "Run DB migrations inside Gitea container"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
/app/gitea/gitea migrate
|
/app/gitea/gitea migrate
|
||||||
args:
|
args:
|
||||||
chdir: "{{ docker_compose.directories.instance }}"
|
chdir: "{{ docker_compose.directories.instance }}"
|
||||||
@@ -24,13 +24,13 @@
|
|||||||
|
|
||||||
- name: "Create initial admin user"
|
- name: "Create initial admin user"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
/app/gitea/gitea admin user create \
|
/app/gitea/gitea admin user create \
|
||||||
--admin \
|
--admin \
|
||||||
--username "{{ users.administrator.username }}" \
|
--username "{{ users.administrator.username }}" \
|
||||||
--password "{{ users.administrator.password }}" \
|
--password "{{ users.administrator.password }}" \
|
||||||
--email "{{ users.administrator.email }}" \
|
--email "{{ users.administrator.email }}" \
|
||||||
-c {{ gitea_config }}
|
-c {{ GITEA_CONFIG }}
|
||||||
args:
|
args:
|
||||||
chdir: "{{ docker_compose.directories.instance }}"
|
chdir: "{{ docker_compose.directories.instance }}"
|
||||||
register: create_admin
|
register: create_admin
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
- name: "Add LDAP Authentication Source"
|
- name: "Add LDAP Authentication Source"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth add-ldap \
|
gitea admin auth add-ldap \
|
||||||
{{ gitea_ldap_auth_args | join(' ') }}
|
{{ GITEA_LDAP_AUTH_ARGS | join(' ') }}
|
||||||
args:
|
args:
|
||||||
chdir: "{{ docker_compose.directories.instance }}"
|
chdir: "{{ docker_compose.directories.instance }}"
|
||||||
register: ldap_manage
|
register: ldap_manage
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
- name: "Lookup existing LDAP auth source ID"
|
- name: "Lookup existing LDAP auth source ID"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth list \
|
gitea admin auth list \
|
||||||
| tail -n +2 \
|
| tail -n +2 \
|
||||||
| grep -F "LDAP ({{ PRIMARY_DOMAIN }})" \
|
| grep -F "LDAP ({{ PRIMARY_DOMAIN }})" \
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
|
|
||||||
- name: "Update LDAP Authentication Source"
|
- name: "Update LDAP Authentication Source"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth update-ldap \
|
gitea admin auth update-ldap \
|
||||||
--id {{ ldap_source_id }} \
|
--id {{ ldap_source_id }} \
|
||||||
{{ gitea_ldap_auth_args | join(' ') }}
|
{{ GITEA_LDAP_AUTH_ARGS | join(' ') }}
|
||||||
args:
|
args:
|
||||||
chdir: "{{ docker_compose.directories.instance }}"
|
chdir: "{{ docker_compose.directories.instance }}"
|
||||||
register: ldap_manage
|
register: ldap_manage
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
- name: "Add Keycloak OIDC Provider"
|
- name: "Add Keycloak OIDC Provider"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth add-oauth \
|
gitea admin auth add-oauth \
|
||||||
--provider openidConnect \
|
--provider openidConnect \
|
||||||
--name "{{ OIDC.BUTTON_TEXT }}" \
|
--name "{{ OIDC.BUTTON_TEXT }}" \
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
- name: "Lookup existing Keycloak auth source ID"
|
- name: "Lookup existing Keycloak auth source ID"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
/app/gitea/gitea admin auth list \
|
/app/gitea/gitea admin auth list \
|
||||||
| tail -n +2 \
|
| tail -n +2 \
|
||||||
| grep -F "{{ OIDC.BUTTON_TEXT }}" \
|
| grep -F "{{ OIDC.BUTTON_TEXT }}" \
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
- name: "Update Keycloak OIDC Provider"
|
- name: "Update Keycloak OIDC Provider"
|
||||||
shell: |
|
shell: |
|
||||||
docker exec -i --user {{ gitea_user }} {{ gitea_container }} \
|
docker exec -i --user {{ GITEA_USER }} {{ GITEA_CONTAINER }} \
|
||||||
gitea admin auth update-oauth \
|
gitea admin auth update-oauth \
|
||||||
--id {{ oidc_source_id }}\
|
--id {{ oidc_source_id }}\
|
||||||
--provider openidConnect \
|
--provider openidConnect \
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
application:
|
application:
|
||||||
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
||||||
image: "{{ gitea_image }}:{{ gitea_version }}"
|
image: "{{ GITEA_IMAGE }}:{{ GITEA_VERSION }}"
|
||||||
container_name: "{{ gitea_container }}"
|
container_name: "{{ GITEA_CONTAINER }}"
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}"
|
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}"
|
||||||
- "{{ports.public.ssh[application_id]}}:22"
|
- "{{ports.public.ssh[application_id]}}:22"
|
||||||
@@ -17,6 +17,6 @@
|
|||||||
|
|
||||||
{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
|
{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
|
||||||
data:
|
data:
|
||||||
name: {{ gitea_volume }}
|
name: {{ GITEA_VOLUME }}
|
||||||
|
|
||||||
{% include 'roles/docker-compose/templates/networks.yml.j2' %}
|
{% include 'roles/docker-compose/templates/networks.yml.j2' %}
|
@@ -1,6 +1,13 @@
|
|||||||
|
# General
|
||||||
application_id: "web-app-gitea"
|
application_id: "web-app-gitea"
|
||||||
database_type: "mariadb"
|
database_type: "mariadb"
|
||||||
gitea_ldap_auth_args:
|
|
||||||
|
# Docker
|
||||||
|
container_port: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.port') }}"
|
||||||
|
docker_compose_flush_handlers: true
|
||||||
|
|
||||||
|
# Gitea
|
||||||
|
GITEA_LDAP_AUTH_ARGS:
|
||||||
- '--name "LDAP ({{ PRIMARY_DOMAIN }})"'
|
- '--name "LDAP ({{ PRIMARY_DOMAIN }})"'
|
||||||
- '--host "{{ ldap.server.domain }}"'
|
- '--host "{{ ldap.server.domain }}"'
|
||||||
- '--port {{ ldap.server.port }}'
|
- '--port {{ ldap.server.port }}'
|
||||||
@@ -15,13 +22,9 @@ gitea_ldap_auth_args:
|
|||||||
- '--email-attribute "{{ ldap.user.attributes.mail }}"'
|
- '--email-attribute "{{ ldap.user.attributes.mail }}"'
|
||||||
- '--public-ssh-key-attribute "{{ ldap.user.attributes.ssh_public_key }}"'
|
- '--public-ssh-key-attribute "{{ ldap.user.attributes.ssh_public_key }}"'
|
||||||
- '--synchronize-users'
|
- '--synchronize-users'
|
||||||
gitea_version: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.version', True) }}"
|
GITEA_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.version') }}"
|
||||||
gitea_image: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.image', True) }}"
|
GITEA_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.image') }}"
|
||||||
gitea_container: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.name', True) }}"
|
GITEA_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.name') }}"
|
||||||
gitea_volume: "{{ applications | get_app_conf(application_id, 'docker.volumes.data', True) }}"
|
GITEA_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}"
|
||||||
gitea_user: "git"
|
GITEA_USER: "git"
|
||||||
gitea_config: "/data/gitea/conf/app.ini"
|
GITEA_CONFIG: "/data/gitea/conf/app.ini"
|
||||||
|
|
||||||
container_port: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.port', True) }}"
|
|
||||||
|
|
||||||
docker_compose_flush_handlers: true
|
|
||||||
|
Reference in New Issue
Block a user