Files
karpenok c0a9d7f0c8
ansible-core-mon / deploy (push) Successful in 25s
ansible-core-net / deploy (push) Failing after 25s
ansible-core-secrets / deploy (push) Successful in 12s
ansible-opnsense / deploy (push) Successful in 5s
ansible-rus-central / deploy (push) Successful in 37s
refactor(auth): remove Authentik SSO, restore basic auth and provision Node Exporter dashboard
2026-11-11 17:45:21 +07:00

77 lines
2.5 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
- name: Создать каталоги Traefik
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
loop:
- "{{ traefik_dir }}"
- "{{ traefik_dynamic_dir }}"
- "{{ traefik_log_dir }}"
- name: Подготовить файл acme.json (если отсутствует)
ansible.builtin.file:
path: "{{ traefik_dir }}/acme.json"
state: touch
owner: root
group: root
mode: "0600"
modification_time: preserve
access_time: preserve
- name: Установить статический конфиг traefik.yml
ansible.builtin.template:
src: traefik.yml.j2
dest: "{{ traefik_dir }}/traefik.yml"
owner: root
group: root
mode: "0644"
notify: Перезапустить Traefik
- name: Установить compose.yaml для Traefik
ansible.builtin.template:
src: compose.yaml.j2
dest: "{{ traefik_dir }}/compose.yaml"
owner: root
group: root
mode: "0644"
- name: Синхронизировать динамические конфигурации маршрутов
ansible.builtin.copy:
src: dynamic/
dest: "{{ traefik_dynamic_dir }}/"
owner: root
group: root
mode: "0644"
- name: Установить конфигурацию Traefik Dashboard с BasicAuth
ansible.builtin.template:
src: dynamic/dashboard.yml.j2
dest: "{{ traefik_dynamic_dir }}/dashboard.yml"
owner: root
group: root
mode: "0644"
when: traefik_dashboard_auth is defined and traefik_dashboard_auth | length > 0
- name: Найти существующие файлы маршрутов на сервере
ansible.builtin.find:
paths: "{{ traefik_dynamic_dir }}"
patterns: "*.yml,*.yaml"
register: remote_dynamic_files
- name: Удалить файлы маршрутов, удаленные из репозитория
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ remote_dynamic_files.files }}"
vars:
repo_files: "{{ (q('fileglob', role_path ~ '/files/dynamic/*.yml') | map('basename') | list) + ['dashboard.yml'] }}"
when: item.path | basename not in repo_files
- name: Запустить Traefik через Docker Compose
ansible.builtin.command: docker compose -f {{ traefik_dir }}/compose.yaml up -d --remove-orphans
register: compose_up
changed_when: "'Started' in compose_up.stderr or 'Created' in compose_up.stderr or 'Recreated' in compose_up.stderr or 'Pulled' in compose_up.stderr"