Files
homelab-infra/ansible/roles/netbird_client/tasks/main.yml
T
karpenokandCursor 72a9c86e52
ansible-core-net / deploy (push) Canceled after 0s
ansible-core-secrets / deploy (push) Canceled after 0s
ansible-ger-nod-02 / deploy (push) Canceled after 0s
ansible-opnsense / deploy (push) Canceled after 0s
ansible-core-mon / deploy (push) Successful in 58s
ansible-rus-central / deploy (push) Successful in 44s
feat: VictoriaMetrics и NetBird между панелью и ger-nod-02
Prometheus остаётся для LAN. Нода отдаёт метрики через vmagent, а панель ходит на неё по отдельному ключу NetBird, не через группу роутеров.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-12 16:50:44 +07:00

87 lines
2.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
- name: Проверить ключ установки Remnawave
ansible.builtin.assert:
that:
- netbird_client_setup_key | length > 0
fail_msg: "Нет NETBIRD_REMNAWAVE_SETUP_KEY. Сначала прогоните ansible-rus-central."
- name: Проверить /dev/net/tun
ansible.builtin.stat:
path: /dev/net/tun
register: netbird_tun
- name: Нет TUN для NetBird
ansible.builtin.fail:
msg: "Нет /dev/net/tun. В LXC для NetBird нужны nesting и устройство /dev/net/tun."
when: not netbird_tun.stat.exists
- name: Поставить зависимости NetBird
ansible.builtin.apt:
name:
- ca-certificates
- curl
- gnupg
state: present
update_cache: true
- name: Ключ репозитория NetBird
ansible.builtin.shell: |
set -euo pipefail
install -d -m 0755 /usr/share/keyrings
curl -fsSL https://pkgs.netbird.io/debian/public.key \
| gpg --dearmor --yes -o /usr/share/keyrings/netbird-archive-keyring.gpg
chmod 0644 /usr/share/keyrings/netbird-archive-keyring.gpg
args:
executable: /bin/bash
creates: /usr/share/keyrings/netbird-archive-keyring.gpg
- name: Репозиторий NetBird
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/netbird.list
content: |
deb [signed-by=/usr/share/keyrings/netbird-archive-keyring.gpg] https://pkgs.netbird.io/debian stable main
owner: root
group: root
mode: "0644"
- name: Поставить клиент NetBird
ansible.builtin.apt:
name: netbird
state: present
update_cache: true
- name: Включить службу NetBird
ansible.builtin.systemd:
name: netbird
enabled: true
state: started
- name: Узнать, подключён ли NetBird
ansible.builtin.command: netbird status
register: netbird_status_before
changed_when: false
failed_when: false
- name: Подключить NetBird к central.gunihome.ru
ansible.builtin.command: >
netbird up
--management-url {{ netbird_client_management_url }}
--setup-key {{ netbird_client_setup_key }}
--hostname {{ netbird_client_hostname }}
no_log: true
when: "'Management: Connected' not in (netbird_status_before.stdout | default(''))"
register: netbird_up
changed_when: true
- name: Дождаться Management Connected
ansible.builtin.command: netbird status
register: netbird_status
changed_when: false
retries: 10
delay: 3
until: "'Management: Connected' in netbird_status.stdout"
- name: Показать состояние NetBird
ansible.builtin.debug:
msg: "{{ netbird_status.stdout_lines | select('search', 'Management:|NetBird IP:|FQDN:|Peers:') | list }}"