homelab/roles/authentik/tasks/start_server.yml

47 lines
1.3 KiB
YAML

---
- name: Disable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: disabled
drain: true
wait: true
backend: authentik
host: s{{ server_idx }}
fail_on_not_found: true
- name: Run authentik server container
become: true
community.docker.docker_container:
name: authentik-{{ server_idx }}
image: "{{ image }}:{{ tag }}"
command: ["server"]
networks:
- name: authentik
- name: postgresql
- name: haproxy
- name: monitoring
user: root
volumes:
- authentik-media:/media
- authentik-templates:/templates
- authentik-certs:/certs
- /etc/letsencrypt/live/comfycamp.space/fullchain.pem:/certs/comfycamp.space/fullchain.pem:ro
- /etc/letsencrypt/live/comfycamp.space/privkey.pem:/certs/comfycamp.space/privkey.pem:ro
env_file: /etc/authentik/.env
restart_policy: unless-stopped
healthcheck:
test: ["CMD", "ak", "healthcheck"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# TODO: enable after ansible update
# state: healthy
- name: Enable server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: enabled
backend: authentik
host: s{{ server_idx }}
fail_on_not_found: true