|
| 1 | +--- |
| 2 | +# NetBird CLI installation (for remote console access) |
| 3 | +# CLI only - not the VPN/UI components |
| 4 | + |
| 5 | +# ============================================================================ |
| 6 | +# FEDORA - Add YUM repository and install |
| 7 | +# ============================================================================ |
| 8 | + |
| 9 | +- name: Install NetBird CLI (Fedora) |
| 10 | + block: |
| 11 | + - name: Add NetBird repository |
| 12 | + ansible.builtin.yum_repository: |
| 13 | + name: netbird |
| 14 | + description: NetBird |
| 15 | + baseurl: https://pkgs.netbird.io/yum/ |
| 16 | + enabled: true |
| 17 | + gpgcheck: false |
| 18 | + gpgkey: https://pkgs.netbird.io/yum/repodata/repomd.xml.key |
| 19 | + repo_gpgcheck: true |
| 20 | + |
| 21 | + - name: Install NetBird CLI |
| 22 | + ansible.builtin.dnf: |
| 23 | + name: netbird |
| 24 | + state: present |
| 25 | + |
| 26 | + when: ansible_distribution == 'Fedora' |
| 27 | + |
| 28 | +# ============================================================================ |
| 29 | +# UBUNTU - Add APT repository and install |
| 30 | +# ============================================================================ |
| 31 | + |
| 32 | +- name: Install NetBird CLI (Ubuntu) |
| 33 | + block: |
| 34 | + - name: Download NetBird GPG key |
| 35 | + ansible.builtin.get_url: |
| 36 | + url: https://pkgs.netbird.io/debian/public.key |
| 37 | + dest: /tmp/netbird.key |
| 38 | + mode: '0644' |
| 39 | + |
| 40 | + - name: Convert NetBird GPG key to keyring format |
| 41 | + ansible.builtin.shell: | |
| 42 | + gpg --dearmor < /tmp/netbird.key > /usr/share/keyrings/netbird-archive-keyring.gpg |
| 43 | + args: |
| 44 | + creates: /usr/share/keyrings/netbird-archive-keyring.gpg |
| 45 | + |
| 46 | + - name: Remove temporary key file |
| 47 | + ansible.builtin.file: |
| 48 | + path: /tmp/netbird.key |
| 49 | + state: absent |
| 50 | + |
| 51 | + - name: Add NetBird repository |
| 52 | + ansible.builtin.apt_repository: |
| 53 | + repo: "deb [signed-by=/usr/share/keyrings/netbird-archive-keyring.gpg] https://pkgs.netbird.io/debian stable main" |
| 54 | + filename: netbird |
| 55 | + state: present |
| 56 | + |
| 57 | + - name: Install NetBird CLI |
| 58 | + ansible.builtin.apt: |
| 59 | + name: netbird |
| 60 | + state: present |
| 61 | + update_cache: true |
| 62 | + |
| 63 | + when: ansible_distribution == 'Ubuntu' |
| 64 | + |
| 65 | +# ============================================================================ |
| 66 | +# macOS - Install via Homebrew |
| 67 | +# ============================================================================ |
| 68 | + |
| 69 | +- name: Install NetBird CLI (macOS) |
| 70 | + block: |
| 71 | + - name: Tap NetBird Homebrew repository |
| 72 | + community.general.homebrew_tap: |
| 73 | + name: netbirdio/tap |
| 74 | + state: present |
| 75 | + |
| 76 | + - name: Install NetBird CLI |
| 77 | + community.general.homebrew: |
| 78 | + name: netbirdio/tap/netbird |
| 79 | + state: present |
| 80 | + |
| 81 | + become: false |
| 82 | + environment: "{{ homebrew_env }}" |
| 83 | + when: ansible_distribution == 'MacOSX' |
0 commit comments