This commit is contained in:
karpenok committed 2026-11-08 11:36:41 +07:00
1 parent 00a0615750
commit 5f91f7bc95
6 files changed
+51 -21

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
---
- name: Перезапустить NetBird
ansible.builtin.command: docker compose up -d --remove-orphans
args:
chdir: "{{ netbird_dir }}"
register: compose_up
changed_when: "'Started' in compose_up.stderr or 'Created' in compose_up.stderr or 'Recreated' in compose_up.stderr"
+30 -1
View File
@@ -22,6 +22,8 @@
ansible.builtin.stat:
path: "{{ netbird_dir }}/.env"
register: netbird_env
tags:
- config
- name: Проверить почту Let's Encrypt
ansible.builtin.assert:
@@ -56,6 +58,8 @@
register: netbird_env_raw
no_log: true
when: netbird_env.stat.exists
tags:
- config
- name: Разобрать сохранённые ключи
ansible.builtin.set_fact:
@@ -68,6 +72,8 @@
env_map: "{{ dict(env_lines | map('split', '=', 1)) }}"
no_log: true
when: netbird_env.stat.exists
tags:
- config
- name: Записать .env
ansible.builtin.template:
@@ -77,6 +83,7 @@
group: root
mode: "0600"
no_log: true
notify: Перезапустить NetBird
when: not netbird_env.stat.exists
- name: Положить манифест панели
@@ -86,6 +93,9 @@
owner: root
group: root
mode: "0644"
notify: Перезапустить NetBird
tags:
- config
- name: Собрать dashboard.env
ansible.builtin.template:
@@ -94,6 +104,9 @@
owner: root
group: root
mode: "0644"
notify: Перезапустить NetBird
tags:
- config
- name: Собрать config.yaml
ansible.builtin.template:
@@ -103,13 +116,23 @@
group: root
mode: "0600"
no_log: true
notify: Перезапустить NetBird
tags:
- config
- name: Поднять панель
- name: Применить изменения конфигурации
ansible.builtin.meta: flush_handlers
tags:
- config
- name: Убедиться, что панель запущена
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ netbird_dir }}"
register: compose_up
changed_when: "'Started' in compose_up.stderr or 'Created' in compose_up.stderr or 'Recreated' in compose_up.stderr"
tags:
- config
- name: Показать состояние контейнеров
ansible.builtin.command: docker compose ps
@@ -117,6 +140,8 @@
chdir: "{{ netbird_dir }}"
register: compose_ps
changed_when: false
tags:
- config
- name: Дождаться ответа панели
ansible.builtin.command: >
@@ -128,7 +153,11 @@
retries: 30
delay: 10
until: panel_http.stdout in ['200', '302']
tags:
- config
- name: Итог установки
ansible.builtin.debug:
msg: "{{ compose_ps.stdout_lines + ['Первый вход: https://' + netbird_domain + '/setup'] }}"
tags:
- config