- name: setup netbird agent gather_facts: no hosts: "{{target}}" become: "{{become_var}}" tasks: - name: check netbird is installed ansible.builtin.shell: executable: /bin/bash cmd: "[[ -x `which netbird` ]]" changed_when: false check_mode: false - name: check client is configured ansible.builtin.shell: executable: /bin/bash cmd: "[[ -n `grep {{netbird_srv}} /etc/netbird/config.json` ]] && echo configured" changed_when: false check_mode: false failed_when: false register: check_result - debug: var=check_result.stdout - debug: var=check_result.stderr - name: configure and start client ansible.builtin.shell: executable: /bin/bash cmd: netbird up --management-url https://{{netbird_srv}}:33073 --admin-url https://{{netbird_srv}} --setup-key {{netbird_install_key}} when: check_result.stdout != 'configured' and setup_key_expired is not defined register: start1_result - debug: var=start1_result.stdout - debug: var=start1_result.stderr - name: simply start client (already configured) ansible.builtin.shell: executable: /bin/bash cmd: netbird up --management-url https://{{netbird_srv}}:33073 --admin-url https://{{netbird_srv}} when: check_result.stdout == 'configured' register: start2_result - debug: var=start2_result.stdout - debug: var=start2_result.stderr