--- - 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 }}"