automatic update of netbird client linux windows from script and ansible #1253
Closed
bohemtucsok
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I created a script that downloads the latest version of the netbird client from github
package_extension=enter the package to be downloaded here, you need it
if you want to run it in ansible
--- - name: Netbird clinet download and install hosts: - your_hosts become: yes tasks: - name: Download and Install shell: | latest_url="https://github.com/netbirdio/netbird/releases/latest" release_tag=$(curl -sIL $latest_url | grep -i 'location' | awk -F '/' '{print $NF}' | tr -d '\r') release_tag_without_v=${release_tag#v} package_extension="netbird_${release_tag_without_v}_linux_amd64.deb" download_url="https://github.com/netbirdio/netbird/releases/download/$release_tag/$package_extension" temp_dir="/tmp" wget -P $temp_dir $download_url sudo dpkg -i $temp_dir/$package_extension sudo apt-get install -f rm $temp_dir/$package_extension register: resulthere you just have to pay attention to the package_extension part
If someone updates to Windows, I wrote a powershell script
and if you would update the clients from Ansible
--- - name: Copy and run PowerShell hosts: your_hosts tasks: - name: Copy the PowerShell script to the target machine win_copy: src: /YOUR_PS1_LOCATIONS/netbird_install_windows.ps1 # Path to the PowerShell script to be copied on the local machine dest: C:\Users\Administrator\AppData\Local\Temp\script.ps1 # Destination path on the target machine register: copy_result - name: Execute the PowerShell script win_shell: | powershell -ExecutionPolicy Bypass -File C:\Users\Administrator\AppData\Local\Temp\script.ps1 when: copy_result.changed # Execute only if the script was copied - name: Remove the script from the target machine win_file: path: C:\Users\Administrator\AppData\Local\Temp\script.ps1 state: absent when: copy_result.changed # Remove only if the script was copiedI hope this makes it a little easier to keep clients fresh :)
Beta Was this translation helpful? Give feedback.
All reactions