refactor(remnawave): синхронизировать панель из desired.yml и шаблонов команд
ansible-deploy / plan (push) Successful in 1s
ansible-lint / lint (push) Successful in 2s
ansible-deploy / deploy (core-mon, ) (push) Successful in 37s
ansible-deploy / deploy (core-net, ) (push) Failing after 52s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 24s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 1m20s
ansible-deploy / deploy (opnsense, ) (push) Successful in 13s
ansible-deploy / deploy (rus-central, ) (push) Successful in 1m6s

Повторный прогон без смены compose не тянет образы, ноды и сквады добавляются данными, а не новым плейбуком на каждый VPS.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
karpenokandCursor committed 2026-11-18 17:18:49 +07:00
1 parent 89f928c64a
commit 99ee815213
22 files changed
+1151 -672

No files matched your search

@@ -0,0 +1,177 @@
# Шаблоны команд Remnawave API. Новый однотипный ресурс — шаг здесь.
# prepare/compare_with/after/run — короткие хуки в sync_remnawave.py
# (ключ Reality, адрес NetBird, uuid профилей, правило Browser, пользователи).
# {поле} подставляется из элемента. Целая строка "{поле}" сохраняет тип (объект, список).
steps:
- id: xray_templates
from: xray_templates
prepare: load_json_file
list: {method: GET, path: /subscription-templates/, key: templates}
match: [name, templateType]
compare: [templateJson]
prune:
where: {templateType: XRAY_JSON}
save: {as: xray_template, key: name}
create:
method: POST
path: /subscription-templates/
body:
name: "{name}"
templateType: "{templateType}"
templateJson: "{templateJson}"
update:
method: PATCH
path: /subscription-templates/
body:
uuid: "{uuid}"
templateJson: "{templateJson}"
delete:
method: DELETE
path: "/subscription-templates/{uuid}"
- id: profiles
from: profiles
prepare: render_profile
list: {method: GET, path: /config-profiles/, key: configProfiles}
match: [name]
compare_with: profile_config
prune: true
save: {as: profile, key: name}
refresh: {method: GET, path: "/config-profiles/{uuid}"}
create:
method: POST
path: /config-profiles/
body:
name: "{name}"
config: "{config}"
update:
method: PATCH
path: /config-profiles/
body:
uuid: "{uuid}"
config: "{config}"
delete:
method: DELETE
path: "/config-profiles/{uuid}"
- id: nodes
from: nodes
prepare: prepare_node
list: {method: GET, path: /nodes/, key: nodes}
match: [name]
compare_with: node_binding
prune: true
after: enable_if_disabled
save: {as: node, key: name}
create:
method: POST
path: /nodes/
body:
name: "{name}"
address: "{address}"
port: "{port}"
countryCode: "{countryCode}"
configProfile: "{configProfile}"
update:
method: PATCH
path: /nodes/
body:
uuid: "{uuid}"
address: "{address}"
port: "{port}"
countryCode: "{countryCode}"
configProfile: "{configProfile}"
update_fallback:
method: PUT
path: /nodes/
body:
uuid: "{uuid}"
address: "{address}"
port: "{port}"
countryCode: "{countryCode}"
configProfile: "{configProfile}"
delete:
method: DELETE
path: "/nodes/{uuid}"
- id: hosts
from: nodes
prepare: prepare_host
list: {method: GET, path: /hosts/, key: hosts}
match_prepared: [address]
compare_with: host_binding
prune: true
save: {as: host, key: address}
create:
method: POST
path: /hosts/
body:
remark: "{remark}"
address: "{address}"
port: "{port}"
path: "{path}"
sni: "{sni}"
host: "{host}"
fingerprint: chrome
isDisabled: false
securityLayer: DEFAULT
alpn: h2
xHttpExtraParams:
xmux:
maxConcurrency: "16-32"
hMaxRequestTimes: "600-900"
hMaxReusableSecs: "1800-3000"
noSSEHeader: true
xPaddingBytes: "100-1000"
inbound:
configProfileUuid: "{profile_uuid}"
configProfileInboundUuid: "{inbound_uuid}"
nodes: "{nodes}"
xrayJsonTemplateUuid: "{xrayJsonTemplateUuid}"
update:
method: PATCH
path: /hosts/
body:
uuid: "{uuid}"
remark: "{remark}"
path: "{path}"
sni: "{sni}"
host: "{host}"
port: "{port}"
alpn: "{alpn}"
fingerprint: "{fingerprint}"
xrayJsonTemplateUuid: "{xrayJsonTemplateUuid}"
nodes: "{nodes}"
delete:
method: DELETE
path: "/hosts/{uuid}"
- id: squads
from: squads
prepare: prepare_squad
list: {method: GET, path: /internal-squads/, key: internalSquads}
match: [name]
compare_with: squad_inbounds
prune: true
save: {as: squad, key: name}
create:
method: POST
path: /internal-squads/
body:
name: "{name}"
inbounds: "{inbounds}"
update:
method: PATCH
path: /internal-squads/
body:
uuid: "{uuid}"
inbounds: "{inbounds}"
delete:
method: DELETE
path: "/internal-squads/{uuid}"
- id: subscription
run: subscription_settings
- id: users
run: users
@@ -0,0 +1,32 @@
# Желаемое состояние панели Remnawave.
# Новая выходная нода: запись в nodes, профиль (если новый), сквад, хост в inventory
# (группы remnanodes и exit_nodes, имя с «-nod-»). Повторный прогон панели — тег remnawave_sync,
# без pull образов. Сквад, нода, host и профиль, которых здесь нет, с панели удаляются.
# Тег inbound уникален среди профилей.
xray_templates:
- name: Except-RU
templateType: XRAY_JSON
file: xray-except-ru.json
profiles:
- name: DE-Yali
template: profile-selfsteal-xhttp.json
inbound_tag: Steal-Yali
selfsteal_domain: yali.gunis.top
xhttp_path: /xhttp-yali
squads:
- name: Default-Squad
inbounds: [Steal-Yali]
subscription_page_config: Homelab
nodes:
- name: Ger-nod-02
address: "150.241.64.209"
netbird_hostname: ger-nod-02
port: 2222
country_code: DE
profile: DE-Yali
host_remark: "🇩🇪 ger-nod-02"
@@ -1,22 +0,0 @@
# Декларативная конфигурация профилей, нод и хостов Remnawave.
# Добавление новой выходной VPS: добавить запись в nodes и прогнать ansible-core-net.
xray_template:
name: Except-RU
file: xray-except-ru.json
squad_name: Default-Squad
subscription_page_config: Homelab
nodes:
- name: Ger-nod-02
address: "150.241.64.209"
netbird_hostname: "ger-nod-02"
port: 2222
country_code: "DE"
profile_name: "DE-Yali"
profile_template: "profile-selfsteal-xhttp.json"
inbound_tag: "Steal-Yali"
selfsteal_domain: "yali.gunis.top"
xhttp_path: "/xhttp-yali"
host_remark: "🇩🇪 ger-nod-02"
File diff suppressed because it is too large. Load diff