refactor(remnawave,exit-node): split bootstrap/sync and generalize ger-nod-02 roles
ansible-core-net / deploy (push) Successful in 1m50s
ansible-core-mon / deploy (push) Successful in 28s
ansible-core-secrets / deploy (push) Successful in 18s
ansible-ger-nod-02 / deploy (push) Failing after 3s
ansible-opnsense / deploy (push) Successful in 9s
ansible-rus-central / deploy (push) Successful in 1m7s
ansible-core-net / deploy (push) Successful in 1m50s
ansible-core-mon / deploy (push) Successful in 28s
ansible-core-secrets / deploy (push) Successful in 18s
ansible-ger-nod-02 / deploy (push) Failing after 3s
ansible-opnsense / deploy (push) Successful in 9s
ansible-rus-central / deploy (push) Successful in 1m7s
This commit is contained in:
1 parent
83baec4bad
commit
2fc6e39323
19 files changed
+1092
-863
No files matched your search
@@ -0,0 +1,59 @@
|
||||
---
|
||||
- name: Загрузить декларативную конфигурацию нод и пользователей Remnawave
|
||||
ansible.builtin.set_fact:
|
||||
remnawave_nodes_cfg: "{{ lookup('file', role_path ~ '/files/nodes.yml') | from_yaml }}"
|
||||
remnawave_users_cfg: "{{ lookup('file', role_path ~ '/files/users.yml') | from_yaml }}"
|
||||
|
||||
- name: Проверить, что панель сама в NetBird
|
||||
ansible.builtin.command: netbird status
|
||||
register: remnawave_local_netbird
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Собрать конфигурацию синхронизации Remnawave
|
||||
ansible.builtin.set_fact:
|
||||
remnawave_sync_payload:
|
||||
panel_domain: "{{ remnawave_panel_domain }}"
|
||||
sub_domain: "{{ remnawave_sub_domain }}"
|
||||
netbird_peers_url: "{{ remnawave_netbird_peers_url }}"
|
||||
netbird_connected: "{{ 'Management: Connected' in (remnawave_local_netbird.stdout | default('')) }}"
|
||||
xray_checker_user: "{{ remnawave_xray_checker_user }}"
|
||||
xray_template: "{{ remnawave_nodes_cfg.xray_template }}"
|
||||
xray_template_json: "{{ lookup('file', role_path ~ '/files/' ~ remnawave_nodes_cfg.xray_template.file) | from_json }}"
|
||||
squad_name: "{{ remnawave_nodes_cfg.squad_name | default('Default-Squad') }}"
|
||||
subscription_page_config: "{{ remnawave_nodes_cfg.subscription_page_config | default('Homelab') }}"
|
||||
nodes: "{{ remnawave_nodes_cfg.nodes | default([]) }}"
|
||||
users: "{{ remnawave_users_cfg.users | default([]) }}"
|
||||
profile_templates:
|
||||
profile-selfsteal-xhttp.json: "{{ lookup('file', role_path ~ '/files/profile-selfsteal-xhttp.json') }}"
|
||||
|
||||
- name: Положить скрипт синхронизации Remnawave
|
||||
ansible.builtin.copy:
|
||||
src: sync_remnawave.py
|
||||
dest: "{{ remnawave_dir }}/sync_remnawave.py"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: Записать конфигурацию синхронизации Remnawave
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ remnawave_dir }}/sync_config.json"
|
||||
content: "{{ remnawave_sync_payload | to_json }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
|
||||
- name: Синхронизировать шаблоны, профили, ноды, хосты и пользователей Remnawave
|
||||
ansible.builtin.command: "python3 {{ remnawave_dir }}/sync_remnawave.py {{ remnawave_dir }}/sync_config.json"
|
||||
environment:
|
||||
RW_API_TOKEN: "{{ remnawave_api_token }}"
|
||||
NB_API_TOKEN: "{{ lookup('env', 'NETBIRD_API_TOKEN', default='') }}"
|
||||
register: remnawave_sync_raw
|
||||
changed_when: (remnawave_sync_raw.stdout | from_json).changed
|
||||
no_log: true
|
||||
|
||||
- name: Разобрать результат синхронизации Remnawave
|
||||
ansible.builtin.set_fact:
|
||||
remnawave_sync: "{{ remnawave_sync_raw.stdout | from_json }}"
|
||||
remnawave_xray_checker_url: "{{ (remnawave_sync_raw.stdout | from_json).xray_checker_subscription_url | default('') }}"
|
||||
no_log: true
|
||||
Reference in new issue
Block a user