Fix issues reported by ansible-lint

This commit is contained in:
Tobias Reisinger 2023-12-13 02:43:15 +01:00
parent a90840b1dc
commit 2e100d290f
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
59 changed files with 315 additions and 244 deletions

2
_ansible/.ansible-lint Normal file
View file

@ -0,0 +1,2 @@
skip_list:
- var-naming[no-role-prefix]

View file

@ -4,8 +4,8 @@
- acme-dns - acme-dns
- certificates - certificates
block: block:
- import_tasks: steps/create-service-directory.yml - name: Import prepare tasks for common service
- import_tasks: steps/template-docker-compose.yml ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Setting the service config path - name: Setting the service config path
ansible.builtin.set_fact: ansible.builtin.set_fact:
@ -23,5 +23,5 @@
dest: "{{ (config_path, 'config.cfg') | path_join }}" dest: "{{ (config_path, 'config.cfg') | path_join }}"
mode: "0600" mode: "0600"
- import_tasks: steps/template-site-config.yml - name: Import start tasks for common service
- import_tasks: steps/start-service.yml ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "acme.serguzim.me" domain: acme.serguzim.me
name: acme-dns name: acme-dns
port: 80 port: 80
nsadmin: "{{ admin_email | regex_replace('@', '.') }}" nsadmin: "{{ admin_email | regex_replace('@', '.') }}"
@ -12,7 +13,6 @@ svc:
pass: "{{ vault_acmedns.db.pass }}" pass: "{{ vault_acmedns.db.pass }}"
db: acme_dns db: acme_dns
compose: compose:
watchtower: true watchtower: true
monitoring: true monitoring: true
@ -24,4 +24,4 @@ compose:
app: app:
ports: ports:
- "53:53" - "53:53"
- "53:53/udp" - 53:53/udp

View file

@ -4,4 +4,5 @@
- authentik - authentik
- authentication - authentication
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "auth.serguzim.me" domain: auth.serguzim.me
name: authentik name: authentik
port: 9000 port: 9000
image_tag: 2023.8 image_tag: 2023.8
@ -32,7 +33,7 @@ svc_env:
compose: compose:
watchtower: false watchtower: false
image: "ghcr.io/goauthentik/server:{{ svc.image_tag }}" image: ghcr.io/goauthentik/server:{{ svc.image_tag }}
env: true env: true
file: file:
services: services:
@ -41,7 +42,7 @@ compose:
depends_on: depends_on:
- redis - redis
worker: worker:
image: "ghcr.io/goauthentik/server:{{ svc.image_tag }}" image: ghcr.io/goauthentik/server:{{ svc.image_tag }}
restart: always restart: always
command: worker command: worker
user: root user: root
@ -53,7 +54,6 @@ compose:
- redis - redis
networks: networks:
default: default:
redis: redis:
image: redis:alpine image: redis:alpine
restart: always restart: always

View file

@ -5,7 +5,10 @@
- reverse_proxy - reverse_proxy
- webserver - webserver
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml
- import_tasks: clean-sites.yml - name: Import tasks for cleaning sites
- import_tasks: reload-caddy.yml ansible.builtin.import_tasks: tasks/clean-sites.yml
- name: Import tasks to reload caddy
ansible.builtin.import_tasks: tasks/reload-caddy.yml

View file

@ -3,4 +3,5 @@
tags: tags:
- coder - coder
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,8 +1,9 @@
---
svc: svc:
domain: "coder.serguzim.me" domain: coder.serguzim.me
additional_domains: additional_domains:
- "*.coder.serguzim.me" - "*.coder.serguzim.me"
caddy_extra: "import acmedns" caddy_extra: import acmedns
name: coder name: coder
port: 7080 port: 7080
db: db:
@ -13,12 +14,12 @@ svc:
svc_env: svc_env:
CODER_ADDRESS: "0.0.0.0:7080" CODER_ADDRESS: "0.0.0.0:7080"
CODER_ACCESS_URL: "https://{{ svc.domain }}" CODER_ACCESS_URL: https://{{ svc.domain }}
CODER_WILDCARD_ACCESS_URL: "*.{{ svc.domain }}" CODER_WILDCARD_ACCESS_URL: "*.{{ svc.domain }}"
CODER_PG_CONNECTION_URL: "postgres://{{ vault_coder.db.user }}:{{ vault_coder.db.pass }}@{{ svc.db.host }}:{{ svc.db.port }}/coder?sslmode=verify-full" CODER_PG_CONNECTION_URL: postgres://{{ vault_coder.db.user }}:{{ vault_coder.db.pass }}@{{ svc.db.host }}:{{ svc.db.port }}/coder?sslmode=verify-full
CODER_OIDC_ISSUER_URL: "https://auth.serguzim.me/application/o/coder-serguzim-me/" CODER_OIDC_ISSUER_URL: https://auth.serguzim.me/application/o/coder-serguzim-me/
CODER_OIDC_CLIENT_ID: "{{ vault_coder.oidc_client.id }}" CODER_OIDC_CLIENT_ID: "{{ vault_coder.oidc_client.id }}"
CODER_OIDC_CLIENT_SECRET: "{{ vault_coder.oidc_client.secret }}" CODER_OIDC_CLIENT_SECRET: "{{ vault_coder.oidc_client.secret }}"
@ -27,9 +28,9 @@ compose:
image: ghcr.io/coder/coder:latest image: ghcr.io/coder/coder:latest
env: true env: true
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
file: file:
services: services:
app: app:
group_add: group_add:
- "972" # docker group on host - "972" # docker group on host

View file

@ -3,4 +3,5 @@
tags: tags:
- faas - faas
block: block:
- import_tasks: steps/template-site-config.yml - name: Import tasks to template the site and functions for the reverse proxy
ansible.builtin.import_tasks: tasks/steps/template-site-config.yml

View file

@ -1,30 +1,31 @@
---
svc: svc:
name: faas name: faas
domain: faas.serguzim.me domain: faas.serguzim.me
docker_host: host.docker.internal docker_host: host.docker.internal
port: 8080 port: 8080
extra_svcs: extra_svcs:
- domain: link.serguzim.me - domain: link.serguzim.me
faas_function: url-mapper faas_function: url-mapper
- domain: msrg.cc - domain: msrg.cc
faas_function: webpage-msrg-cc faas_function: webpage-msrg-cc
caddy_extra: | caddy_extra: |
header /.well-known/* Access-Control-Allow-Origin * header /.well-known/* Access-Control-Allow-Origin *
handle /.well-known/webfinger { handle /.well-known/webfinger {
map {query.resource} {user} { map {query.resource} {user} {
acct:tobias@msrg.cc serguzim acct:tobias@msrg.cc serguzim
acct:serguzim@msrg.cc serguzim acct:serguzim@msrg.cc serguzim
} }
rewrite * /.well-known/webfinger/{user}.json rewrite * /.well-known/webfinger/{user}.json
import faas webpage-msrg-cc import faas webpage-msrg-cc
} }
- domain: serguzim.me - domain: serguzim.me
faas_function: webpage-serguzim-me faas_function: webpage-serguzim-me
www_domain: true www_domain: true
hsts: true hsts: true
- domain: team-leon.eu - domain: team-leon.eu
faas_function: webpage-team-leon-eu faas_function: webpage-team-leon-eu
www_domain: true www_domain: true
- domain: xn--sder-5qa.stream - domain: xn--sder-5qa.stream
faas_function: webpage-soeder-stream faas_function: webpage-soeder-stream

View file

@ -6,31 +6,35 @@
- ci - ci
- forgejo-runner - forgejo-runner
block: block:
- import_tasks: steps/create-service-directory.yml - name: Import tasks to create service directory
- import_tasks: steps/template-docker-compose.yml ansible.builtin.import_tasks: tasks/steps/create-service-directory.yml
- name: Import tasks to template docker compose file
ansible.builtin.import_tasks: tasks/steps/template-docker-compose.yml
- name: Copy the config - name: Copy the config
ansible.builtin.copy: ansible.builtin.copy:
src: config.yml src: config.yml
dest: "{{ (service_path, 'config.yml') | path_join }}" dest: "{{ (service_path, 'config.yml') | path_join }}"
mode: '0755' mode: "0755"
- name: Check if service.env already exists - name: Check if service.env already exists
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ (service_path, 'service.env') | path_join }}" path: "{{ (service_path, 'service.env') | path_join }}"
register: svc_env_file register: svc_env_file
- import_tasks: prompt-registration-token.yml - name: Import tasks to prompt for the registration token
when: not svc_env_file.stat.exists or ansible.builtin.import_tasks: tasks/prompt-registration-token.yml
force_forgejo_runner_registration | default(False) when: not svc_env_file.stat.exists or force_forgejo_runner_registration | default(False)
- import_tasks: steps/template-service-env.yml - name: Import tasks create a service.env file
ansible.builtin.import_tasks: tasks/steps/template-service-env.yml
- import_tasks: steps/start-service.yml - name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml
- name: Register runner - name: Register runner
ansible.builtin.command: ansible.builtin.command:
cmd: docker compose run --rm -it app sh -c 'forgejo-runner register --no-interactive --token ${FORGEJO_RUNNER_REGISTRATION_TOKEN} --instance ${FORGEJO_INSTANCE_URL}' cmd: docker compose run --rm -it app sh -c
'forgejo-runner register --no-interactive --token ${FORGEJO_RUNNER_REGISTRATION_TOKEN} --instance ${FORGEJO_INSTANCE_URL}'
chdir: "{{ service_path }}" chdir: "{{ service_path }}"
when: not svc_env_file.stat.exists or when: not svc_env_file.stat.exists or force_forgejo_runner_registration | default(False)
force_forgejo_runner_registration | default(False) changed_when: true # "when" checks enough. We are sure to change something here.

View file

@ -1,11 +1,10 @@
---
- name: Input forgejo-runner registration token - name: Input forgejo-runner registration token
ansible.builtin.pause: ansible.builtin.pause:
prompt: "Enter a secret" prompt: Enter a secret
echo: no echo: false
register: promt_registration_token register: promt_registration_token
- name: Put registration token into env vars - name: Put registration token into env vars
ansible.builtin.set_fact: ansible.builtin.set_fact:
svc_env: "{{ svc_env | combine({ svc_env: "{{ svc_env | combine({'FORGEJO_RUNNER_REGISTRATION_TOKEN': promt_registration_token.user_input}, recursive=True) }}"
'FORGEJO_RUNNER_REGISTRATION_TOKEN': promt_registration_token.user_input
}, recursive=True) }}"

View file

@ -1,8 +1,9 @@
---
svc: svc:
name: forgejo-runner name: forgejo-runner
svc_env: svc_env:
FORGEJO_INSTANCE_URL: "https://git.serguzim.me/" FORGEJO_INSTANCE_URL: https://git.serguzim.me/
FORGEJO_RUNNER_REGISTRATION_TOKEN: FORGEJO_RUNNER_REGISTRATION_TOKEN:
DOCKER_HOST: tcp://docker-in-docker:2375 DOCKER_HOST: tcp://docker-in-docker:2375
@ -17,7 +18,7 @@ compose:
services: services:
app: app:
hostname: "{{ ansible_facts.hostname }}" hostname: "{{ ansible_facts.hostname }}"
command: "forgejo-runner --config /config/config.yml daemon" command: forgejo-runner --config /config/config.yml daemon
depends_on: depends_on:
- docker-in-docker - docker-in-docker
links: links:
@ -25,7 +26,7 @@ compose:
docker-in-docker: docker-in-docker:
image: docker:dind image: docker:dind
privileged: true privileged: true
command: "dockerd -H tcp://0.0.0.0:2375 --tls=false" command: dockerd -H tcp://0.0.0.0:2375 --tls=false
networks: networks:
default: default:
volumes: volumes:

View file

@ -4,4 +4,5 @@
- forgejo - forgejo
- git - git
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "git.serguzim.me" domain: git.serguzim.me
name: forgejo name: forgejo
port: 3000 port: 3000
caddy_extra: header /attachments/* Access-Control-Allow-Origin * caddy_extra: header /attachments/* Access-Control-Allow-Origin *
@ -10,26 +11,26 @@ svc:
ssh_port_alt: 3022 ssh_port_alt: 3022
svc_env: svc_env:
FORGEJO__database__DB_TYPE: "postgres" FORGEJO__database__DB_TYPE: postgres
FORGEJO__database__HOST: "{{ svc.db.host }}:{{ svc.db.port }}" FORGEJO__database__HOST: "{{ svc.db.host }}:{{ svc.db.port }}"
FORGEJO__database__NAME: "forgejo" FORGEJO__database__NAME: forgejo
FORGEJO__database__USER: "{{ vault_forgejo.db.user }}" FORGEJO__database__USER: "{{ vault_forgejo.db.user }}"
FORGEJO__database__PASSWD: "{{ vault_forgejo.db.pass }}" FORGEJO__database__PASSWD: "{{ vault_forgejo.db.pass }}"
FORGEJO__database__SSL_MODE: "verify-full" FORGEJO__database__SSL_MODE: verify-full
FORGEJO__repository__ENABLE_PUSH_CREATE_USER: true FORGEJO__repository__ENABLE_PUSH_CREATE_USER: true
FORGEJO__repository__ENABLE_PUSH_CREATE_ORG: true FORGEJO__repository__ENABLE_PUSH_CREATE_ORG: true
FORGEJO__repository__DEFAULT_BRANCH: "main" FORGEJO__repository__DEFAULT_BRANCH: main
FORGEJO__cors__ENABLED: true FORGEJO__cors__ENABLED: true
FORGEJO__cors__SCHEME: "https" FORGEJO__cors__SCHEME: https
FORGEJO__ui__DEFAULT_THEME: "arc-green" FORGEJO__ui__DEFAULT_THEME: arc-green
FORGEJO__server__DOMAIN: "{{ svc.domain }}" FORGEJO__server__DOMAIN: "{{ svc.domain }}"
FORGEJO__server__SSH_DOMAIN: "{{ svc.domain }}" FORGEJO__server__SSH_DOMAIN: "{{ svc.domain }}"
FORGEJO__server__SSH_PORT: "{{ svc.ssh_port }}" FORGEJO__server__SSH_PORT: "{{ svc.ssh_port }}"
FORGEJO__server__ROOT_URL: "https://{{ svc.domain }}" FORGEJO__server__ROOT_URL: https://{{ svc.domain }}
FORGEJO__server__OFFLINE_MODE: true FORGEJO__server__OFFLINE_MODE: true
FORGEJO__server__LFS_JWT_SECRET: "{{ vault_forgejo.server_lfs_jwt_secret }}" FORGEJO__server__LFS_JWT_SECRET: "{{ vault_forgejo.server_lfs_jwt_secret }}"
FORGEJO__server__LFS_START_SERVER: true FORGEJO__server__LFS_START_SERVER: true
@ -44,34 +45,34 @@ svc_env:
FORGEJO__service__ALLOW_ONLY_EXTERNAL_REGISTRATION: true FORGEJO__service__ALLOW_ONLY_EXTERNAL_REGISTRATION: true
FORGEJO__service__ENABLE_BASIC_AUTHENTICATION: false FORGEJO__service__ENABLE_BASIC_AUTHENTICATION: false
FORGEJO__service__DEFAULT_KEEP_EMAIL_PRIVATE: true FORGEJO__service__DEFAULT_KEEP_EMAIL_PRIVATE: true
FORGEJO__service__NO_REPLY_ADDRESS: "discard.msrg.cc" FORGEJO__service__NO_REPLY_ADDRESS: discard.msrg.cc
FORGEJO__webhook__DELIVER_TIMEOUT: 60 FORGEJO__webhook__DELIVER_TIMEOUT: 60
FORGEJO__mailer__ENABLED: true FORGEJO__mailer__ENABLED: true
FORGEJO__mailer__PROTOCOL: "smtp+starttls" FORGEJO__mailer__PROTOCOL: smtp+starttls
FORGEJO__mailer__SMTP_ADDR: "mail.serguzim.me" FORGEJO__mailer__SMTP_ADDR: mail.serguzim.me
FORGEJO__mailer__SMTP_PORT: 587 FORGEJO__mailer__SMTP_PORT: 587
FORGEJO__mailer__FROM: "Forgejo <git@serguzim.me>" FORGEJO__mailer__FROM: Forgejo <git@serguzim.me>
FORGEJO__mailer__USER: "git@serguzim.me" FORGEJO__mailer__USER: git@serguzim.me
FORGEJO__mailer__PASSWD: "{{ vault_forgejo.mailer_passwd }}" FORGEJO__mailer__PASSWD: "{{ vault_forgejo.mailer_passwd }}"
FORGEJO__mailer__SEND_AS_PLAIN_TEXT: true FORGEJO__mailer__SEND_AS_PLAIN_TEXT: true
FORGEJO__picture__DISABLE_GRAVATAR: true FORGEJO__picture__DISABLE_GRAVATAR: true
FORGEJO__oauth2__JWT_SECRET: "{{ vault_forgejo. oauth2_jwt_secret}}" FORGEJO__oauth2__JWT_SECRET: "{{ vault_forgejo.oauth2_jwt_secret }}"
FORGEJO__metrics__ENABLED: true FORGEJO__metrics__ENABLED: true
FORGEJO__metrics__TOKEN: "{{ vault_metrics_token }}" FORGEJO__metrics__TOKEN: "{{ vault_metrics_token }}"
FORGEJO__actions__ENABLED: true FORGEJO__actions__ENABLED: true
FORGEJO__storage__STORAGE_TYPE: "minio" FORGEJO__storage__STORAGE_TYPE: minio
FORGEJO__storage__MINIO_ENDPOINT: "s3.serguzim.me" FORGEJO__storage__MINIO_ENDPOINT: s3.serguzim.me
FORGEJO__storage__MINIO_ACCESS_KEY_ID: "{{ vault_forgejo.minio.access_key_id }}" FORGEJO__storage__MINIO_ACCESS_KEY_ID: "{{ vault_forgejo.minio.access_key_id }}"
FORGEJO__storage__MINIO_SECRET_ACCESS_KEY: "{{ vault_forgejo.minio.secret_access_key }}" FORGEJO__storage__MINIO_SECRET_ACCESS_KEY: "{{ vault_forgejo.minio.secret_access_key }}"
FORGEJO__storage__MINIO_BUCKET: "forgejo" FORGEJO__storage__MINIO_BUCKET: forgejo
FORGEJO__storage__MINIO_LOCATION: "de-contabo-1" FORGEJO__storage__MINIO_LOCATION: de-contabo-1
FORGEJO__storage__MINIO_USE_SSL: true FORGEJO__storage__MINIO_USE_SSL: true
FORGEJO__other__SHOW_FOOTER_VERSION: true FORGEJO__other__SHOW_FOOTER_VERSION: true
@ -93,4 +94,3 @@ compose:
- "{{ svc.ssh_port_alt }}:{{ svc.ssh_port }}" - "{{ svc.ssh_port_alt }}:{{ svc.ssh_port }}"
volumes: volumes:
data: data:

View file

@ -4,8 +4,11 @@
- harbor - harbor
- registry - registry
block: block:
- import_tasks: steps/create-service-directory.yml - name: Import prepare tasks for common service
- import_tasks: steps/template-site-config.yml ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Import tasks to template the site for the reverse proxy
ansible.builtin.import_tasks: tasks/steps/template-site-config.yml
- name: Template config - name: Template config
ansible.builtin.template: ansible.builtin.template:
@ -17,12 +20,13 @@
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: https://github.com/goharbor/harbor/releases/download/v{{ svc.harbor_version }}/harbor-online-installer-v{{ svc.harbor_version }}.tgz src: https://github.com/goharbor/harbor/releases/download/v{{ svc.harbor_version }}/harbor-online-installer-v{{ svc.harbor_version }}.tgz
dest: "{{ service_path }}" dest: "{{ service_path }}"
remote_src: yes remote_src: true
- name: Run the harbor prepare command - name: Run the harbor prepare command
ansible.builtin.command: ansible.builtin.command:
cmd: "{{ service_path }}/harbor/prepare" cmd: "{{ service_path }}/harbor/prepare"
chdir: "{{ service_path }}" chdir: "{{ service_path }}"
creates: "{{ (service_path, 'docker-compose.yml') | path_join }}"
environment: environment:
HARBOR_BUNDLE_DIR: "{{ service_path }}" HARBOR_BUNDLE_DIR: "{{ service_path }}"
@ -33,3 +37,4 @@
environment: environment:
HARBOR_BUNDLE_DIR: "{{ service_path }}" HARBOR_BUNDLE_DIR: "{{ service_path }}"
become: true become: true
changed_when: true # TODO find way to recognize need to run install command

View file

@ -1,3 +1,4 @@
---
svc_ports: svc_ports:
http: 20080 http: 20080
https: 20443 https: 20443
@ -5,7 +6,8 @@ svc_ports:
svc: svc:
name: harbor name: harbor
domain: "registry.serguzim.me" no_compose: true # TODO remove when fixing "var-naming[no-role-prefix]"
domain: registry.serguzim.me
caddy_extra: | caddy_extra: |
reverse_proxy /metrics host.docker.internal:{{ svc_ports.metrics }} reverse_proxy /metrics host.docker.internal:{{ svc_ports.metrics }}
reverse_proxy host.docker.internal:{{ svc_ports.https }} { reverse_proxy host.docker.internal:{{ svc_ports.https }} {
@ -75,9 +77,9 @@ svc_yml:
max_idle_conns: 2 max_idle_conns: 2
max_open_conns: 0 max_open_conns: 0
proxy: proxy:
http_proxy: null http_proxy:
https_proxy: null https_proxy:
no_proxy: null no_proxy:
components: components:
- core - core
- jobservice - jobservice

View file

@ -3,38 +3,40 @@
tags: tags:
- healthcheck - healthcheck
block: block:
- import_tasks: steps/create-service-directory.yml - name: Import tasks to create service directory
ansible.builtin.import_tasks: tasks/steps/create-service-directory.yml
- name: Copy the docker-compose file - name: Copy the docker-compose file
ansible.builtin.copy: ansible.builtin.copy:
src: docker-compose.yml src: docker-compose.yml
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}" dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
mode: '0644' mode: "0644"
- name: Copy the Dockerfile - name: Copy the Dockerfile
ansible.builtin.copy: ansible.builtin.copy:
src: Dockerfile src: Dockerfile
dest: "{{ (service_path, 'Dockerfile') | path_join }}" dest: "{{ (service_path, 'Dockerfile') | path_join }}"
mode: '0644' mode: "0644"
- name: Copy the data files - name: Copy the data files
ansible.builtin.copy: ansible.builtin.copy:
src: data src: data
dest: "{{ service_path }}" dest: "{{ service_path }}"
mode: '0755' mode: "0755"
- name: Copy the system service - name: Copy the system service
ansible.builtin.copy: ansible.builtin.copy:
src: healthcheck@.service src: healthcheck@.service
dest: "/etc/systemd/system/healthcheck@.service" dest: /etc/systemd/system/healthcheck@.service
mode: '0644' mode: "0644"
become: true become: true
- name: Copy the system timer - name: Copy the system timer
ansible.builtin.copy: ansible.builtin.copy:
src: healthcheck@.timer src: healthcheck@.timer
dest: "/etc/systemd/system/healthcheck@.timer" dest: /etc/systemd/system/healthcheck@.timer
mode: '0644' mode: "0644"
become: true become: true
- import_tasks: steps/template-service-env.yml - name: Import tasks create a service.env file
ansible.builtin.import_tasks: tasks/steps/template-service-env.yml
- name: Build service - name: Build service
ansible.builtin.command: ansible.builtin.command:
@ -43,4 +45,4 @@
when: when:
- "'local-dev' != inventory_hostname" - "'local-dev' != inventory_hostname"
register: cmd_result register: cmd_result
changed_when: True changed_when: true

View file

@ -1,13 +1,14 @@
---
svc: svc:
name: healthcheck name: healthcheck
svc_env: svc_env:
USER_AGENT: "healthcheck-bot for serguzim.net" USER_AGENT: healthcheck-bot for serguzim.net
HTTP_HC_UID: "{{ vault_healthcheck.hc_uid.http }}" HTTP_HC_UID: "{{ vault_healthcheck.hc_uid.http }}"
MATRIX_SERVER: "https://matrix.msrg.cc" MATRIX_SERVER: https://matrix.msrg.cc
MATRIX_SERVER_FEDTESTER: "msrg.cc" MATRIX_SERVER_FEDTESTER: msrg.cc
MATRIX_HC_UID: "{{ vault_healthcheck.hc_uid.matrix }}" MATRIX_HC_UID: "{{ vault_healthcheck.hc_uid.matrix }}"
MATRIX_TOKEN: "{{ vault_healthcheck.matrix.token }}" MATRIX_TOKEN: "{{ vault_healthcheck.matrix.token }}"
MATRIX_ROOM: "{{ vault_healthcheck.matrix.room }}" MATRIX_ROOM: "{{ vault_healthcheck.matrix.room }}"

View file

@ -4,4 +4,5 @@
- homebox - homebox
- inventory - inventory
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "inventory.serguzim.me" domain: inventory.serguzim.me
name: homebox name: homebox
port: 7745 port: 7745
@ -21,4 +22,3 @@ compose:
file: file:
volumes: volumes:
data: data:

View file

@ -4,8 +4,8 @@
- influxdb - influxdb
- sensors - sensors
block: block:
- import_tasks: steps/create-service-directory.yml - name: Import prepare tasks for common service
- import_tasks: steps/template-docker-compose.yml ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Template config - name: Template config
ansible.builtin.template: ansible.builtin.template:
@ -13,5 +13,5 @@
dest: "{{ (service_path, 'influxdb.yml') | path_join }}" dest: "{{ (service_path, 'influxdb.yml') | path_join }}"
mode: "0600" mode: "0600"
- import_tasks: steps/template-site-config.yml - name: Import start tasks for common service
- import_tasks: steps/start-service.yml ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -1,8 +1,9 @@
---
svc: svc:
domain: "tick.serguzim.me" domain: tick.serguzim.me
name: influxdb name: influxdb
port: 8086 port: 8086
data_dir: "/var/lib/influxdb2" data_dir: /var/lib/influxdb2
svc_yml: svc_yml:
assets-path: "" assets-path: ""
@ -10,7 +11,7 @@ svc_yml:
e2e-testing: false e2e-testing: false
engine-path: "{{ (svc.data_dir, 'engine') | path_join }}" engine-path: "{{ (svc.data_dir, 'engine') | path_join }}"
feature-flags: {} feature-flags: {}
http-bind-address: 0.0.0.0:{{ svc.port }} http-bind-address: "0.0.0.0:{{ svc.port }}"
influxql-max-select-buckets: 0 influxql-max-select-buckets: 0
influxql-max-select-point: 0 influxql-max-select-point: 0
influxql-max-select-series: 0 influxql-max-select-series: 0
@ -42,7 +43,7 @@ svc_yml:
storage-shard-precreator-check-interval: 10m0s storage-shard-precreator-check-interval: 10m0s
storage-tsm-use-madv-willneed: false storage-tsm-use-madv-willneed: false
storage-validate-keys: false storage-validate-keys: false
storage-wal-fsync-delay: 0s storage-wal-fsync-delay: "0s"
store: bolt store: bolt
testing-always-allow-setup: false testing-always-allow-setup: false
tls-cert: "" tls-cert: ""
@ -55,7 +56,7 @@ svc_yml:
vault-capath: "" vault-capath: ""
vault-client-cert: "" vault-client-cert: ""
vault-client-key: "" vault-client-key: ""
vault-client-timeout: 0s vault-client-timeout: "0s"
vault-max-retries: 0 vault-max-retries: 0
vault-skip-verify: false vault-skip-verify: false
vault-tls-server-name: "" vault-tls-server-name: ""

View file

@ -4,4 +4,5 @@
- jellyfin - jellyfin
- media - media
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "media.serguzim.me" domain: media.serguzim.me
name: jellyfin name: jellyfin
port: 8096 port: 8096
db: db:
@ -7,7 +8,7 @@ svc:
port: "{{ postgres.port }}" port: "{{ postgres.port }}"
svc_env: svc_env:
JELLYFIN_PublishedServerUrl: "https://{{ svc. domain }}" JELLYFIN_PublishedServerUrl: https://{{ svc.domain }}
compose: compose:
watchtower: true watchtower: true
@ -25,4 +26,3 @@ compose:
config: config:
cache: cache:
media: media:

View file

@ -4,4 +4,5 @@
- mailcow - mailcow
- email - email
block: block:
- import_tasks: steps/template-site-config.yml - name: Import tasks to template the site for the reverse proxy
ansible.builtin.import_tasks: tasks/steps/template-site-config.yml

View file

@ -1,3 +1,4 @@
---
svc: svc:
name: mailcow name: mailcow
domain: mail.serguzim.me domain: mail.serguzim.me

View file

@ -5,4 +5,5 @@
- minecraft - minecraft
- games - games
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,3 +1,4 @@
---
svc: svc:
name: minecraft-2 name: minecraft-2
@ -21,7 +22,7 @@ svc_env:
FUNCTION_PERMISSION_LEVEL: 2 FUNCTION_PERMISSION_LEVEL: 2
GENERATE_STRUCTURES: true GENERATE_STRUCTURES: true
HARDCORDE: false HARDCORDE: false
ICON: ICON:
LEVEL_TYPE: DEFAULT LEVEL_TYPE: DEFAULT
MAX_BUILD_HEIGHT: 512 MAX_BUILD_HEIGHT: 512
MAX_MEMORY: 4G MAX_MEMORY: 4G
@ -29,7 +30,7 @@ svc_env:
MAX_PLAYERS: 64 MAX_PLAYERS: 64
MAX_WORLD_SIZE: 30000000 MAX_WORLD_SIZE: 30000000
MODE: survival MODE: survival
MOTD: MOTD:
NETWORK_COMPRESSION_THRESHOLD: 256 NETWORK_COMPRESSION_THRESHOLD: 256
PVP: true PVP: true
SERVER_NAME: minecraft.serguzim.me SERVER_NAME: minecraft.serguzim.me
@ -63,6 +64,6 @@ compose:
services: services:
app: app:
ports: ports:
- "25565:25565" - 25565:25565
volumes: volumes:
data: data:

View file

@ -4,4 +4,5 @@
- minio - minio
- storage - storage
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,21 +1,22 @@
---
svc: svc:
domain: "s3.serguzim.me" domain: s3.serguzim.me
name: minio name: minio
port: 9000 port: 9000
caddy_extra: | caddy_extra: |
@nocache { @nocache {
query nocache=* query nocache=*
} }
header @nocache "Cache-Control" "no-store, no-cache" header @nocache "Cache-Control" "no-store, no-cache"
extra_svcs: extra_svcs:
- domain: console.s3.serguzim.me - domain: console.s3.serguzim.me
docker_host: minio docker_host: minio
port: 9001 port: 9001
svc_env: svc_env:
MINIO_SERVER_URL: "https://{{ svc.domain }}/" MINIO_SERVER_URL: https://{{ svc.domain }}/
MINIO_BROWSER_REDIRECT_URL: "https://console.{{ svc.domain }}" MINIO_BROWSER_REDIRECT_URL: https://console.{{ svc.domain }}
MINIO_VOLUMES: "/data" MINIO_VOLUMES: /data
MINIO_ROOT_USER: "{{ vault_minio.user }}" MINIO_ROOT_USER: "{{ vault_minio.user }}"
MINIO_ROOT_PASSWORD: "{{ vault_minio.pass }}" MINIO_ROOT_PASSWORD: "{{ vault_minio.pass }}"

View file

@ -4,11 +4,13 @@
- synapse - synapse
- matrix - matrix
block: block:
- import_tasks: prepare-common-service.yml - name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Set synapse config path - name: Set synapse config path
ansible.builtin.set_fact: ansible.builtin.set_fact:
config_path: "{{ (service_path, svc.config_path) | path_join }}" config_path: "{{ (service_path, svc.config_path) | path_join }}"
- name: Create config directory - name: Create config directory
ansible.builtin.file: ansible.builtin.file:
path: "{{ config_path }}" path: "{{ config_path }}"
@ -20,17 +22,18 @@
src: service.yml.j2 src: service.yml.j2
dest: "{{ (config_path, 'homeserver.yaml') | path_join }}" dest: "{{ (config_path, 'homeserver.yaml') | path_join }}"
mode: "0644" mode: "0644"
- name: Copy the log config - name: Copy the log config
ansible.builtin.copy: ansible.builtin.copy:
src: msrg.cc.log.config src: msrg.cc.log.config
dest: "{{ (config_path, 'msrg.cc.log.config') | path_join }}" dest: "{{ (config_path, 'msrg.cc.log.config') | path_join }}"
mode: '0644' mode: "0644"
- name: Copy the signing key - name: Copy the signing key
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ vault_synapse.signing_key }}" content: "{{ vault_synapse.signing_key }}"
dest: "{{ (config_path, 'msrg.cc.signing.key') | path_join }}" dest: "{{ (config_path, 'msrg.cc.signing.key') | path_join }}"
mode: '0644' mode: "0644"
- import_tasks: start-common-service.yml - name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -1,6 +1,7 @@
---
svc: svc:
name: synapse name: synapse
domain: "matrix.msrg.cc" domain: matrix.msrg.cc
docker_host: synapse-admin docker_host: synapse-admin
port: 80 port: 80
caddy_extra: | caddy_extra: |
@ -11,7 +12,7 @@ svc:
reverse_proxy synapse:8008 reverse_proxy synapse:8008
} }
extra_svcs: extra_svcs:
- domain: "msrg.cc:8008" - domain: msrg.cc:8008
additional_domains: additional_domains:
- matrix.msrg.cc:8448 - matrix.msrg.cc:8448
- matrix.msrg.cc:8008 - matrix.msrg.cc:8008
@ -30,7 +31,7 @@ svc_env:
REACT_APP_SERVER: https://matrix.msrg.cc REACT_APP_SERVER: https://matrix.msrg.cc
svc_yml: svc_yml:
server_name: "msrg.cc" server_name: msrg.cc
pid_file: "{{ (svc.config_path, 'homeserver.pid') | path_join }}" pid_file: "{{ (svc.config_path, 'homeserver.pid') | path_join }}"
public_baseurl: https://matrix.msrg.cc/ public_baseurl: https://matrix.msrg.cc/
allow_public_rooms_without_auth: true allow_public_rooms_without_auth: true
@ -43,28 +44,28 @@ svc_yml:
x_forwarded: true x_forwarded: true
resources: resources:
- names: - names:
- client - client
- federation - federation
- metrics - metrics
compress: false compress: false
admin_contact: "mailto:{{ admin_email }}" admin_contact: mailto:{{ admin_email }}
acme: acme:
enabled: false enabled: false
database: database:
name: "psycopg2" name: psycopg2
args: args:
user: "{{ svc.db.user }}" user: "{{ svc.db.user }}"
password: "{{ svc.db.pass }}" password: "{{ svc.db.pass }}"
database: "{{ svc.db.database }}" database: "{{ svc.db.database }}"
host: "{{ svc.db.host }}" host: "{{ svc.db.host }}"
cp_min: 5 cp_min: 5
cp_max: 10 cp_max: 10
log_config: "{{ (svc.config_path, 'msrg.cc.log.config') | path_join }}" log_config: "{{ (svc.config_path, 'msrg.cc.log.config') | path_join }}"
media_store_path: "/media_store" media_store_path: /media_store
max_upload_size: 500M max_upload_size: 500M
enable_registration: false enable_registration: false
enable_metrics: true enable_metrics: true
@ -75,19 +76,19 @@ svc_yml:
signing_key_path: "{{ (svc.config_path, 'msrg.cc.signing.key') | path_join }}" signing_key_path: "{{ (svc.config_path, 'msrg.cc.signing.key') | path_join }}"
trusted_key_servers: trusted_key_servers:
- server_name: "matrix.org" - server_name: matrix.org
suppress_key_server_warning: true suppress_key_server_warning: true
oidc_providers: oidc_providers:
- idp_id: "auth_serguzim_me" - idp_id: auth_serguzim_me
idp_name: "auth.serguzim.me" idp_name: auth.serguzim.me
issuer: "https://auth.serguzim.me/application/o/matrix_serguzim_me/" issuer: https://auth.serguzim.me/application/o/matrix_serguzim_me/
client_id: "{{ vault_synapse.oidc_client.id }}" client_id: "{{ vault_synapse.oidc_client.id }}"
client_secret: "{{ vault_synapse.oidc_client.secret }}" client_secret: "{{ vault_synapse.oidc_client.secret }}"
scopes: scopes:
- "openid" - openid
- "profile" - profile
- "email" - email
user_mapping_provider: user_mapping_provider:
config: config:
localpart_template: "{{ '{{ user.preferred_username }}' }}" localpart_template: "{{ '{{ user.preferred_username }}' }}"
@ -96,10 +97,10 @@ svc_yml:
email: email:
smtp_host: mail.serguzim.me smtp_host: mail.serguzim.me
smtp_port: 587 smtp_port: 587
smtp_user: "matrix@serguzim.me" smtp_user: matrix@serguzim.me
smtp_pass: "{{ vault_synapse.mail.pass }}" smtp_pass: "{{ vault_synapse.mail.pass }}"
require_transport_security: true require_transport_security: true
notif_from: "Matrix <matrix@serguzim.me>" notif_from: Matrix <matrix@serguzim.me>
compose: compose:
watchtower: true watchtower: true
@ -111,15 +112,15 @@ compose:
file: file:
services: services:
synapse-admin: synapse-admin:
image: awesometechnologies/synapse-admin image: awesometechnologies/synapse-admin
restart: always restart: always
labels: labels:
com.centurylinklabs.watchtower.enable: true com.centurylinklabs.watchtower.enable: true
env_file: env_file:
- service.env - service.env
networks: networks:
apps: apps:
aliases: aliases:
- synapse-admin - synapse-admin
volumes: volumes:
media_store: media_store:

View file

@ -4,4 +4,5 @@
- tandoor - tandoor
- recipies - recipies
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "recipes.serguzim.me" domain: recipes.serguzim.me
name: tandoor name: tandoor
port: 80 port: 80
db: db:
@ -18,7 +19,7 @@ svc_env:
TZ: "{{ timezone }}" TZ: "{{ timezone }}"
DB_ENGINE: django.db.backends.postgresql DB_ENGINE: django.db.backends.postgresql
DB_OPTIONS: "{\"sslmode\": \"require\"}" DB_OPTIONS: '{"sslmode": "require"}'
POSTGRES_HOST: "{{ svc.db.host }}" POSTGRES_HOST: "{{ svc.db.host }}"
POSTGRES_PORT: "{{ svc.db.port }}" POSTGRES_PORT: "{{ svc.db.port }}"
POSTGRES_DB: "{{ svc.db.database }}" POSTGRES_DB: "{{ svc.db.database }}"
@ -61,4 +62,3 @@ compose:
nginx_config: nginx_config:
staticfiles: staticfiles:
mediafiles: mediafiles:

View file

@ -4,8 +4,8 @@
- telegraf - telegraf
- monitoring - monitoring
block: block:
- import_tasks: steps/create-service-directory.yml - name: Import prepare tasks for common service
- import_tasks: steps/template-docker-compose.yml ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Template config - name: Template config
ansible.builtin.template: ansible.builtin.template:
@ -14,10 +14,10 @@
mode: "0664" mode: "0664"
register: cmd_result register: cmd_result
- name: Set the docker force-recreate flag - name: Set the docker force-recreate flag
ansible.builtin.set_fact: ansible.builtin.set_fact:
docker_force_recreate: "--force-recreate" docker_force_recreate: --force-recreate
when: cmd_result.changed when: cmd_result.changed # noqa: no-handler We need to handle the restart per service. Handlers don't support variables.
- import_tasks: steps/start-service.yml - name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -1,7 +1,8 @@
---
svc: svc:
name: telegraf name: telegraf
influxdb: influxdb:
url: "https://tick.serguzim.me" url: https://tick.serguzim.me
token: "{{ vault_telegraf.influxdb_token }}" token: "{{ vault_telegraf.influxdb_token }}"
organization: serguzim.net organization: serguzim.net
bucket: metrics bucket: metrics
@ -17,9 +18,9 @@ svc:
pass: "{{ vault_telegraf.db.pass }}" pass: "{{ vault_telegraf.db.pass }}"
host: "{{ postgres.host }}" host: "{{ postgres.host }}"
port: "{{ postgres.port }}" port: "{{ postgres.port }}"
database: "telegraf" database: telegraf
docker_log: docker_log:
endpoint: "unix:///var/run/docker.sock" endpoint: unix:///var/run/docker.sock
# from_beginning: false # from_beginning: false
# timeout: "5s" # timeout: "5s"
@ -32,12 +33,12 @@ svc:
## Set the source tag for the metrics to the container ID hostname, eg first 12 chars ## Set the source tag for the metrics to the container ID hostname, eg first 12 chars
source_tag: false source_tag: false
## Optional TLS Config ## Optional TLS Config
# tls_ca: "/etc/telegraf/ca.pem" # tls_ca: "/etc/telegraf/ca.pem"
# tls_cert: "/etc/telegraf/cert.pem" # tls_cert: "/etc/telegraf/cert.pem"
# tls_key: "/etc/telegraf/key.pem" # tls_key: "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification ## Use TLS but skip chain & host verification
# insecure_skip_verify: false # insecure_skip_verify: false
compose: compose:
watchtower: false watchtower: false
@ -50,6 +51,6 @@ compose:
app: app:
user: telegraf user: telegraf
group_add: group_add:
- "972" # docker group on host - "972" # docker group on host
volumes: volumes:
data: data:

View file

@ -5,12 +5,14 @@
- tt-rss - tt-rss
- news - news
block: block:
- import_tasks: prepare-common-service.yml - name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Copy the nginx-config - name: Copy the nginx-config
ansible.builtin.copy: ansible.builtin.copy:
src: nginx.conf src: nginx.conf
dest: "{{ (service_path, 'nginx.conf') | path_join }}" dest: "{{ (service_path, 'nginx.conf') | path_join }}"
mode: '0644' mode: "0644"
- import_tasks: start-common-service.yml - name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "rss.serguzim.me" domain: rss.serguzim.me
name: tinytinyrss name: tinytinyrss
port: 80 port: 80
db: db:
@ -39,7 +40,6 @@ compose:
- app:/var/www/html - app:/var/www/html
networks: networks:
default: default:
updater: updater:
image: cthulhoo/ttrss-fpm-pgsql-static image: cthulhoo/ttrss-fpm-pgsql-static
restart: always restart: always
@ -54,4 +54,3 @@ compose:
default: default:
volumes: volumes:
app: app:

View file

@ -4,4 +4,5 @@
- umami - umami
- analytics - analytics
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "analytics.serguzim.me" domain: analytics.serguzim.me
name: umami name: umami
port: 3000 port: 3000
db: db:

View file

@ -4,4 +4,5 @@
- uptime-kuma - uptime-kuma
- status - status
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,7 +1,8 @@
---
svc: svc:
domain: "status.serguzim.me" domain: status.serguzim.me
additional_domains: additional_domains:
- "status.serguzim.net" - status.serguzim.net
name: uptime-kuma name: uptime-kuma
port: 3001 port: 3001
@ -13,4 +14,3 @@ compose:
file: file:
volumes: volumes:
data: data:

View file

@ -4,10 +4,11 @@
- watchtower - watchtower
- container - container
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml
- name: Copy the run-once script - name: Copy the run-once script
ansible.builtin.copy: ansible.builtin.copy:
src: run-once.sh src: run-once.sh
dest: "{{ (service_path, 'run-once.sh') | path_join }}" dest: "{{ (service_path, 'run-once.sh') | path_join }}"
mode: '0755' mode: "0755"

View file

@ -1,3 +1,4 @@
---
svc: svc:
name: watchtower name: watchtower

View file

@ -3,12 +3,14 @@
tags: tags:
- webdis - webdis
block: block:
- import_tasks: steps/create-service-directory.yml - name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Copy the config - name: Copy the config
ansible.builtin.copy: ansible.builtin.copy:
src: webdis.json src: webdis.json
dest: "{{ (service_path, 'webdis.json') | path_join }}" dest: "{{ (service_path, 'webdis.json') | path_join }}"
mode: '0755' mode: "0755"
- import_tasks: deploy-common-service.yml - name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -1,6 +1,7 @@
---
svc: svc:
name: webdis name: webdis
domain: "webdis.huck.serguzim.me" domain: webdis.huck.serguzim.me
port: 7379 port: 7379
compose: compose:

View file

@ -3,4 +3,5 @@
tags: tags:
- wiki-js - wiki-js
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,5 +1,6 @@
---
svc: svc:
domain: "wiki.serguzim.me" domain: wiki.serguzim.me
name: wiki-js name: wiki-js
port: 3000 port: 3000
db: db:
@ -7,7 +8,7 @@ svc:
port: "{{ postgres.port }}" port: "{{ postgres.port }}"
user: "{{ vault_wiki_js.db.user }}" user: "{{ vault_wiki_js.db.user }}"
pass: "{{ vault_wiki_js.db.pass }}" pass: "{{ vault_wiki_js.db.pass }}"
name: "wikijs" name: wikijs
svc_env: svc_env:
DB_TYPE: postgres DB_TYPE: postgres

View file

@ -4,4 +4,5 @@
- woodpecker - woodpecker
- ci - ci
block: block:
- import_tasks: deploy-common-service.yml - name: Import tasks to deploy common service
ansible.builtin.import_tasks: tasks/deploy-common-service.yml

View file

@ -1,11 +1,12 @@
---
svc: svc:
domain: "ci.serguzim.me" domain: ci.serguzim.me
name: woodpecker name: woodpecker
port: 8000 port: 8000
extra_svcs: extra_svcs:
- domain: agents.ci.serguzim.me - domain: agents.ci.serguzim.me
docker_host: h2c://woodpecker docker_host: h2c://woodpecker
port: 9000 port: 9000
db: db:
host: "{{ postgres.host }}" host: "{{ postgres.host }}"
port: "{{ postgres.port }}" port: "{{ postgres.port }}"
@ -15,8 +16,8 @@ svc:
svc_env: svc_env:
WOODPECKER_OPEN: true WOODPECKER_OPEN: true
WOODPECKER_HOST: "https://{{ svc.domain }}" WOODPECKER_HOST: https://{{ svc.domain }}
WOODPECKER_ADMIN: "serguzim" WOODPECKER_ADMIN: serguzim
WOODPECKER_AGENT_SECRET: "{{ vault_woodpecker.agent_secret }}" WOODPECKER_AGENT_SECRET: "{{ vault_woodpecker.agent_secret }}"
WOODPECKER_PROMETHEUS_AUTH_TOKEN: "{{ vault_metrics_token }}" WOODPECKER_PROMETHEUS_AUTH_TOKEN: "{{ vault_metrics_token }}"
@ -24,12 +25,12 @@ svc_env:
WOODPECKER_GRPC_SECURE: true WOODPECKER_GRPC_SECURE: true
WOODPECKER_GITEA: true WOODPECKER_GITEA: true
WOODPECKER_GITEA_URL: "https://git.serguzim.me" WOODPECKER_GITEA_URL: https://git.serguzim.me
WOODPECKER_GITEA_CLIENT: "{{ vault_woodpecker.gitea.client }}" WOODPECKER_GITEA_CLIENT: "{{ vault_woodpecker.gitea.client }}"
WOODPECKER_GITEA_SECRET: "{{ vault_woodpecker.gitea.secret }}" WOODPECKER_GITEA_SECRET: "{{ vault_woodpecker.gitea.secret }}"
WOODPECKER_DATABASE_DRIVER: "postgres" WOODPECKER_DATABASE_DRIVER: postgres
WOODPECKER_DATABASE_DATASOURCE: "postgres://{{ svc.db.user }}:{{ svc.db.pass }}@{{ svc.db.host }}:{{ svc.db.port }}/{{ svc.db.database }}?sslmode=verify-full" WOODPECKER_DATABASE_DATASOURCE: postgres://{{ svc.db.user }}:{{ svc.db.pass }}@{{ svc.db.host }}:{{ svc.db.port }}/{{ svc.db.database }}?sslmode=verify-full
compose: compose:
watchtower: true watchtower: true

View file

@ -1,2 +1,5 @@
- import_tasks: prepare-common-service.yml ---
- import_tasks: start-common-service.yml - name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Import start tasks for common service
ansible.builtin.import_tasks: tasks/start-common-service.yml

View file

@ -1,4 +1,11 @@
- import_tasks: steps/create-service-directory.yml ---
- import_tasks: steps/template-docker-compose.yml - name: Import tasks to create service directory
- import_tasks: steps/template-service-env.yml ansible.builtin.import_tasks: tasks/steps/create-service-directory.yml
when: compose.env|default(False) == True
- name: Import tasks to template docker compose file
ansible.builtin.import_tasks: tasks/steps/template-docker-compose.yml
when: not no_compose|default(False) # TODO remove when fixing "var-naming[no-role-prefix]"
- name: Import tasks create a service.env file
ansible.builtin.import_tasks: tasks/steps/template-service-env.yml
when: compose.env|default(False)

View file

@ -1,3 +1,6 @@
- include_tasks: steps/template-site-config.yml ---
- name: Import tasks to template the site for the reverse proxy
ansible.builtin.include_tasks: tasks/steps/template-site-config.yml
when: svc.domain is defined when: svc.domain is defined
- import_tasks: steps/start-service.yml - name: Import tasks to start the service
ansible.builtin.import_tasks: tasks/steps/start-service.yml

View file

@ -1,3 +1,4 @@
---
- name: Set common facts - name: Set common facts
ansible.builtin.set_fact: ansible.builtin.set_fact:
service_path: "{{ (services_path, svc.name) | path_join }}" service_path: "{{ (services_path, svc.name) | path_join }}"

View file

@ -1,3 +1,4 @@
---
- name: Build service - name: Build service
ansible.builtin.command: ansible.builtin.command:
cmd: docker compose build --pull cmd: docker compose build --pull
@ -7,7 +8,7 @@
- docker_update is defined - docker_update is defined
- docker_update - docker_update
register: cmd_result register: cmd_result
changed_when: True changed_when: true
- name: Pull service - name: Pull service
ansible.builtin.command: ansible.builtin.command:
@ -18,7 +19,7 @@
- docker_update is defined - docker_update is defined
- docker_update - docker_update
register: cmd_result register: cmd_result
changed_when: True changed_when: true
- name: Start service - name: Start service
ansible.builtin.command: ansible.builtin.command:
@ -26,4 +27,4 @@
chdir: "{{ service_path }}" chdir: "{{ service_path }}"
when: "'local-dev' != inventory_hostname" when: "'local-dev' != inventory_hostname"
register: cmd_result register: cmd_result
changed_when: "cmd_result.stderr | regex_search('Started$')" changed_when: cmd_result.stderr | regex_search('Started$')

View file

@ -1,3 +1,4 @@
---
- name: Template docker-compose - name: Template docker-compose
ansible.builtin.template: ansible.builtin.template:
src: docker-compose.yml.j2 src: docker-compose.yml.j2

View file

@ -1,3 +1,4 @@
---
- name: Template service.env file - name: Template service.env file
ansible.builtin.template: ansible.builtin.template:
src: service.env.j2 src: service.env.j2

View file

@ -1,3 +1,4 @@
---
- name: Template caddy site - name: Template caddy site
ansible.builtin.template: ansible.builtin.template:
src: caddy_site.conf.j2 src: caddy_site.conf.j2