chore: remove NetBird and Authentik layers from homelab
ansible-deploy / plan (push) Successful in 2s
ansible-lint / lint (push) Successful in 3s
ansible-deploy / deploy (core-mon, ) (push) Successful in 39s
ansible-deploy / deploy (core-net, ) (push) Successful in 57s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 25s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 57s
ansible-deploy / deploy (opnsense, ) (push) Successful in 15s
ansible-deploy / plan (push) Successful in 2s
ansible-lint / lint (push) Successful in 3s
ansible-deploy / deploy (core-mon, ) (push) Successful in 39s
ansible-deploy / deploy (core-net, ) (push) Successful in 57s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 25s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 57s
ansible-deploy / deploy (opnsense, ) (push) Successful in 15s
This commit is contained in:
1 parent
6417bdcc75
commit
6a2f90797a
55 files changed
+134
-2460
No files matched your search
@@ -14,5 +14,8 @@ vmagent_cadvisor_listen_ip: "{{ '0.0.0.0' if (vmagent_pull_only_target | bool) e
|
||||
vmagent_metrics_user: admin
|
||||
vmagent_metrics_pass: "{{ lookup('env', 'REMNAWAVE_METRICS_PASS', default='') }}"
|
||||
vmagent_metrics_port: 3001
|
||||
vmagent_panel_egress_ips:
|
||||
- "213.128.28.107" # провайдер 1 (МТС)
|
||||
- "185.160.137.140" # провайдер 2
|
||||
monitoring_node_exporter_public: true
|
||||
monitoring_node_exporter_listen: "0.0.0.0:9100"
|
||||
@@ -24,52 +24,27 @@
|
||||
enabled: true
|
||||
when: vmagent_exporter_env is changed
|
||||
|
||||
- name: Узнать NetBird IP панели (core-net) для pull-доступа к метрикам
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
netbird status --json | jq -r '.peers.details[]? | select(.fqdn | startswith("core-net.")) | .netbirdIp' | head -n 1
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: vmagent_panel_nb_ip
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: vmagent_pull_only_target | bool
|
||||
|
||||
- name: Разрешить pull метрик (9100, 9101) только с NetBird IP панели (core-net)
|
||||
- name: Разрешить pull метрик (9100, 9101) только с WAN egress панели (core-net)
|
||||
ansible.builtin.command: >
|
||||
ufw allow from {{ vmagent_panel_nb_ip.stdout | trim }} to any port {{ item }} proto tcp
|
||||
loop:
|
||||
- 9100
|
||||
- 9101
|
||||
ufw allow from {{ item.0 }} to any port {{ item.1 }} proto tcp
|
||||
loop: "{{ (remnanode_panel_egress_ips | default(vmagent_panel_egress_ips)) | product([9100, 9101]) | list }}"
|
||||
register: ufw_pull_metrics
|
||||
changed_when: "'added' in (ufw_pull_metrics.stdout | default('') | lower)"
|
||||
when:
|
||||
- vmagent_pull_only_target | bool
|
||||
- vmagent_panel_nb_ip.stdout | default('') | trim is match('^[0-9.]+$')
|
||||
when: vmagent_pull_only_target | bool
|
||||
|
||||
- name: Собрать NetBird IP выходных нод (exit_nodes) для pull с core-net
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
nb_json=$(netbird status --json)
|
||||
jq -c -n --argjson nb "${nb_json}" --argjson hosts '{{ (groups["exit_nodes"] | default([])) | to_json }}' '
|
||||
[
|
||||
$hosts[] as $h
|
||||
| ($nb.peers.details[]? | select(.fqdn | startswith($h + ".")) | .netbirdIp) as $ip
|
||||
| select($ip != null and $ip != "")
|
||||
| {name: $h, ip: $ip}
|
||||
]
|
||||
'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: vmagent_exit_targets_raw
|
||||
changed_when: false
|
||||
when: vmagent_scrape_remnawave | bool
|
||||
|
||||
- name: Задать список NetBird pull-целей для vmagent
|
||||
- name: Сбросить список внешних pull-целей для vmagent
|
||||
ansible.builtin.set_fact:
|
||||
vmagent_netbird_exit_targets: "{{ vmagent_exit_targets_raw.stdout | from_json }}"
|
||||
vmagent_remote_pull_targets: []
|
||||
when: vmagent_scrape_remnawave | bool
|
||||
|
||||
- name: Собрать внешние ноды (remnanodes) для pull с core-net
|
||||
ansible.builtin.set_fact:
|
||||
vmagent_remote_pull_targets: "{{ vmagent_remote_pull_targets + [{'name': item, 'ip': hostvars[item].ansible_host}] }}"
|
||||
loop: "{{ groups['remnanodes'] | default([]) | sort }}"
|
||||
when:
|
||||
- vmagent_scrape_remnawave | bool
|
||||
- hostvars[item].ansible_host is defined
|
||||
|
||||
- name: Дождаться VictoriaMetrics
|
||||
ansible.builtin.command: curl -fsS --max-time 5 {{ vmagent_remote_health_url }}
|
||||
register: vmagent_vm_health
|
||||
@@ -171,7 +146,7 @@
|
||||
msg:
|
||||
- >-
|
||||
{{
|
||||
'Pull-таргет ' ~ inventory_hostname ~ ': node_exporter (:9100) и cAdvisor (:9101) доступны только по NetBird с core-net'
|
||||
'Pull-таргет ' ~ inventory_hostname ~ ': node_exporter (:9100) и cAdvisor (:9101) доступны с WAN egress core-net'
|
||||
if (vmagent_pull_only_target | bool)
|
||||
else 'vmagent ' ~ inventory_hostname ~ ' пишет в ' ~ vmagent_remote_write_url ~ ' (exit_targets=' ~ ((vmagent_netbird_exit_targets | default([])) | length) ~ ')'
|
||||
else 'vmagent ' ~ inventory_hostname ~ ' пишет в ' ~ vmagent_remote_write_url ~ ' (remote_targets=' ~ ((vmagent_remote_pull_targets | default([])) | length) ~ ')'
|
||||
}}
|
||||
@@ -5,7 +5,7 @@
|
||||
labels:
|
||||
instance: "{{ vmagent_instance }}"
|
||||
cluster: "{{ vmagent_cluster }}"
|
||||
{% for target in (vmagent_netbird_exit_targets | default([])) %}
|
||||
{% for target in (vmagent_remote_pull_targets | default([])) %}
|
||||
- targets: ["{{ target.ip }}:9101"]
|
||||
labels:
|
||||
instance: "{{ target.name }}"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
labels:
|
||||
instance: "{{ vmagent_instance }}"
|
||||
cluster: "{{ vmagent_cluster }}"
|
||||
{% for target in (vmagent_netbird_exit_targets | default([])) %}
|
||||
{% for target in (vmagent_remote_pull_targets | default([])) %}
|
||||
- targets: ["{{ target.ip }}:9100"]
|
||||
labels:
|
||||
instance: "{{ target.name }}"
|
||||
|
||||
Reference in new issue
Block a user