feat(ci): enable automatic push trigger and declarative file deletion sync in core_net role
ansible-core-net / deploy (push) Successful in 16s
ansible-core-net / deploy (push) Successful in 16s
This commit is contained in:
1 parent
93c3afaebf
commit
2ded3a8585
2 files changed
+21
-1
No files matched your search
@@ -1,6 +1,12 @@
|
|||||||
name: ansible-core-net
|
name: ansible-core-net
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'ansible/roles/core_net/**'
|
||||||
|
- 'ansible/playbooks/core_net.yml'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -46,8 +46,22 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
|
- 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 }}"
|
||||||
|
when: item.path | basename not in repo_files
|
||||||
|
|
||||||
- name: Запустить Traefik через Docker Compose
|
- name: Запустить Traefik через Docker Compose
|
||||||
ansible.builtin.command: docker compose -f {{ traefik_dir }}/compose.yaml up -d
|
ansible.builtin.command: docker compose -f {{ traefik_dir }}/compose.yaml up -d
|
||||||
register: compose_up
|
register: compose_up
|
||||||
changed_when: "'Started' in compose_up.stdout or 'Running' in compose_up.stdout or 'Created' in compose_up.stdout"
|
changed_when: "'Started' in compose_up.stdout or 'Running' in compose_up.stdout or 'Created' in compose_up.stdout"
|
||||||
|
|
||||||
Reference in new issue
Block a user