Problems when deploying via ansible #305

Closed
opened 2025-11-20 05:09:23 -05:00 by saavagebueno · 5 comments
Owner

Originally created by @ykorzikowski on GitHub (Mar 28, 2023).

Describe the problem
I created a ansible role for deploying netbird automatically.

For this, I retrieve the setup key via bitwarden vault, install netbird and run the up command afterwards. (Will add this to github later)

There are two issues I am dealing with right now:

  1. sometimes, the up command fails (actually most of the times). Not sure if its timing issue or something. I am trying to retry it multiple times or restarting the netbird service

  2. When re-installing my server via ansible role, connecting a second time to netbird will result into different dns name. E.g. server.example.com will be server-1.example.com after running it a second time.
    Question: Is there an option for delelting it automatically? Now, I need to manually delete the old netbird entry in the webinterface.

Are there plans improving automatic netbird deployment for servers?

Originally created by @ykorzikowski on GitHub (Mar 28, 2023). **Describe the problem** I created a ansible role for deploying netbird automatically. For this, I retrieve the setup key via bitwarden vault, install netbird and run the up command afterwards. (Will add this to github later) There are two issues I am dealing with right now: 1. sometimes, the up command fails (actually most of the times). Not sure if its timing issue or something. I am trying to retry it multiple times or restarting the netbird service 2. When re-installing my server via ansible role, connecting a second time to netbird will result into different dns name. E.g. server.example.com will be server-1.example.com after running it a second time. Question: Is there an option for delelting it automatically? Now, I need to manually delete the old netbird entry in the webinterface. Are there plans improving automatic netbird deployment for servers?
Author
Owner

@ykorzikowski commented on GitHub (Mar 28, 2023):

Bit more logging:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb9fedc]

goroutine 65 [running]:
github.com/netbirdio/netbird/client/server.(*Server).Status(0xc0002637c0, {0xc0002675c0?, 0x497ee6?}, 0xc0002675c0)
        /home/runner/work/netbird/netbird/client/server/server.go:437 +0x27c
github.com/netbirdio/netbird/client/proto._DaemonService_Status_Handler({0xf8c6c0?, 0xc0002637c0}, {0x11c8380, 0xc000267590}, 0xc0002807e0, 0x0)
        /home/runner/work/netbird/netbird/client/proto/daemon_grpc.pb.go:213 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001be1e0, {0x11d0878, 0xc000284ea0}, 0xc000678000, 0xc000267200, 0x1867a48, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:1336 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc0001be1e0, {0x11d0878, 0xc000284ea0}, 0xc000678000, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:1704 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:963 +0x28a
/var/log/netbird/netbird.err (END)
@ykorzikowski commented on GitHub (Mar 28, 2023): Bit more logging: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb9fedc] goroutine 65 [running]: github.com/netbirdio/netbird/client/server.(*Server).Status(0xc0002637c0, {0xc0002675c0?, 0x497ee6?}, 0xc0002675c0) /home/runner/work/netbird/netbird/client/server/server.go:437 +0x27c github.com/netbirdio/netbird/client/proto._DaemonService_Status_Handler({0xf8c6c0?, 0xc0002637c0}, {0x11c8380, 0xc000267590}, 0xc0002807e0, 0x0) /home/runner/work/netbird/netbird/client/proto/daemon_grpc.pb.go:213 +0x170 google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001be1e0, {0x11d0878, 0xc000284ea0}, 0xc000678000, 0xc000267200, 0x1867a48, 0x0) /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:1336 +0xd23 google.golang.org/grpc.(*Server).handleStream(0xc0001be1e0, {0x11d0878, 0xc000284ea0}, 0xc000678000, 0x0) /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:1704 +0xa2f google.golang.org/grpc.(*Server).serveStreams.func1.2() /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:965 +0x98 created by google.golang.org/grpc.(*Server).serveStreams.func1 /home/runner/go/pkg/mod/google.golang.org/grpc@v1.52.3/server.go:963 +0x28a /var/log/netbird/netbird.err (END) ```
Author
Owner

@ykorzikowski commented on GitHub (Mar 28, 2023):

This is my WIP role:

---

- name: Install netbird dependencies
  apt:
    name: "{{ item }}"
    state: present
    update_cache: yes
  with_items: 
    - ca-certificates
    - curl
    - gnupg

- name: Add public key for wiretrustee
  apt_key:
    url: https://pkgs.wiretrustee.com/debian/public.key
    state: present

- name: Add wiretrustee repository into sources list
  apt_repository:
    repo: deb https://pkgs.wiretrustee.com/debian stable main
    state: present
    filename: wiretrustee.list

- name: Install netbird packages
  apt: 
    name: netbird
    state: present
    update_cache: yes

- name: Remove linux-image-amd64
  apt:
    name: "{{ item }}"
    state: absent
  with_items: 
    - linux-image-amd64
    - 'linux-image-5.10*'

- name: update-grub
  become: yes
  shell: /usr/sbin/update-grub2

- name: Start netbird service
  shell: "netbird service start"

- name: Setup netbird VPN
  shell: "netbird up --setup-key {{ netbird_setup_key }} --management-url {{ netbird_url }}"
  register: result
  until: "result is not failed"
  retries: 10
  delay: 30

- name: pause a bit for netbird coming up
  pause: seconds=15

- name: Get netbird vpn.
  shell: "netbird status |grep 'NetBird IP'|sed 's/NetBird IP: //'|sed 's#/16##'"
  register: netbirdb_ip

- name: saving netbird_ip.
  set_fact:
    netbird_host_ip: "{{netbirdb_ip['stdout_lines'][0]}}"

- debug: var=netbird_host_ip

@ykorzikowski commented on GitHub (Mar 28, 2023): This is my WIP role: ``` --- - name: Install netbird dependencies apt: name: "{{ item }}" state: present update_cache: yes with_items: - ca-certificates - curl - gnupg - name: Add public key for wiretrustee apt_key: url: https://pkgs.wiretrustee.com/debian/public.key state: present - name: Add wiretrustee repository into sources list apt_repository: repo: deb https://pkgs.wiretrustee.com/debian stable main state: present filename: wiretrustee.list - name: Install netbird packages apt: name: netbird state: present update_cache: yes - name: Remove linux-image-amd64 apt: name: "{{ item }}" state: absent with_items: - linux-image-amd64 - 'linux-image-5.10*' - name: update-grub become: yes shell: /usr/sbin/update-grub2 - name: Start netbird service shell: "netbird service start" - name: Setup netbird VPN shell: "netbird up --setup-key {{ netbird_setup_key }} --management-url {{ netbird_url }}" register: result until: "result is not failed" retries: 10 delay: 30 - name: pause a bit for netbird coming up pause: seconds=15 - name: Get netbird vpn. shell: "netbird status |grep 'NetBird IP'|sed 's/NetBird IP: //'|sed 's#/16##'" register: netbirdb_ip - name: saving netbird_ip. set_fact: netbird_host_ip: "{{netbirdb_ip['stdout_lines'][0]}}" - debug: var=netbird_host_ip ```
Author
Owner

@pappz commented on GitHub (Mar 29, 2023):

@ykorzikowski I checked your error message and I see this issue already has been solved. More info: https://github.com/netbirdio/netbird/issues/764
In the next release the fix will be available.

@pappz commented on GitHub (Mar 29, 2023): @ykorzikowski I checked your error message and I see this issue already has been solved. More info: https://github.com/netbirdio/netbird/issues/764 In the next release the fix will be available.
Author
Owner

@mlsmaycon commented on GitHub (Apr 1, 2023):

@ykorzikowski the latest v0.14.6 contains the fix for the issue, can you validate?

@mlsmaycon commented on GitHub (Apr 1, 2023): @ykorzikowski the latest v0.14.6 contains the fix for the issue, can you validate?
Author
Owner

@ykorzikowski commented on GitHub (Apr 14, 2023):

Hey @mlsmaycon ,

Tested it now for couple of times and did not see the error in the most recent version :) so I think its solved

@ykorzikowski commented on GitHub (Apr 14, 2023): Hey @mlsmaycon , Tested it now for couple of times and did not see the error in the most recent version :) so I think its solved
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#305