fix(remnawave): populate Cascade-RU-DE clients via squad and surface sync_remnawave errors
This commit is contained in:
1 parent
0a963c4150
commit
0c308bf7fe
3 files changed
+23
-2
No files matched your search
@@ -2,6 +2,15 @@
|
|||||||
"log": {
|
"log": {
|
||||||
"loglevel": "warning"
|
"loglevel": "warning"
|
||||||
},
|
},
|
||||||
|
"dns": {
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"address": "https://dns.google/dns-query",
|
||||||
|
"skipFallback": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"queryStrategy": "UseIP"
|
||||||
|
},
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
"tag": "__INBOUND_TAG__",
|
"tag": "__INBOUND_TAG__",
|
||||||
|
|||||||
@@ -212,9 +212,14 @@ def ensure_cascade_credentials(
|
|||||||
if has_cascade_inb and ru_prof:
|
if has_cascade_inb and ru_prof:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
_, users_resp = api.request("GET", "/users/")
|
||||||
|
users_list = _extract_list(users_resp, "users")
|
||||||
|
homelab_user = next((u for u in users_list if u.get("username") == "homelab"), None)
|
||||||
|
cascade_uuid = (homelab_user or {}).get("vlessUuid") or str(uuid.uuid4())
|
||||||
|
|
||||||
priv, pub = generate_x25519(api)
|
priv, pub = generate_x25519(api)
|
||||||
creds = {
|
creds = {
|
||||||
"uuid": str(uuid.uuid4()),
|
"uuid": cascade_uuid,
|
||||||
"priv": priv,
|
"priv": priv,
|
||||||
"pub": pub,
|
"pub": pub,
|
||||||
"short_id": secrets.token_hex(8),
|
"short_id": secrets.token_hex(8),
|
||||||
@@ -669,6 +674,7 @@ def main() -> int:
|
|||||||
api, node_cfg, cfg.get("profile_templates", {}), cascade_creds, changes
|
api, node_cfg, cfg.get("profile_templates", {}), cascade_creds, changes
|
||||||
)
|
)
|
||||||
inbound_uuids.append(inbound_uuid)
|
inbound_uuids.append(inbound_uuid)
|
||||||
|
inbound_uuids.extend(extra_inbound_uuids)
|
||||||
sync_node_and_host(
|
sync_node_and_host(
|
||||||
api,
|
api,
|
||||||
node_cfg,
|
node_cfg,
|
||||||
|
|||||||
@@ -51,9 +51,15 @@
|
|||||||
RW_API_TOKEN: "{{ remnawave_api_token }}"
|
RW_API_TOKEN: "{{ remnawave_api_token }}"
|
||||||
NB_API_TOKEN: "{{ lookup('env', 'NETBIRD_API_TOKEN', default='') }}"
|
NB_API_TOKEN: "{{ lookup('env', 'NETBIRD_API_TOKEN', default='') }}"
|
||||||
register: remnawave_sync_raw
|
register: remnawave_sync_raw
|
||||||
changed_when: (remnawave_sync_raw.stdout | from_json).changed
|
changed_when: remnawave_sync_raw.rc == 0 and (remnawave_sync_raw.stdout | from_json).changed
|
||||||
|
failed_when: false
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
|
- name: Показать ошибку sync_remnawave.py без секретов
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "sync_remnawave.py failed (rc={{ remnawave_sync_raw.rc }}): {{ remnawave_sync_raw.stderr | default('') }}"
|
||||||
|
when: remnawave_sync_raw.rc != 0
|
||||||
|
|
||||||
- name: Разобрать результат синхронизации Remnawave
|
- name: Разобрать результат синхронизации Remnawave
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
remnawave_sync: "{{ remnawave_sync_raw.stdout | from_json }}"
|
remnawave_sync: "{{ remnawave_sync_raw.stdout | from_json }}"
|
||||||
|
|||||||
Reference in new issue
Block a user