Closed gmsh-1 closed 2 weeks ago
Hi, took a snippet from my role to update beszel and updated your playbook:
---
- name: Update PVE Beszel Agent
hosts: all
become: yes
become_user: root
tasks:
- name: Update beszel
ansible.builtin.shell: "/opt/beszel/beszel update"
ignore_errors: true
register: metadata_command_output
- name: Update beszel agent
ansible.builtin.shell: "/opt/beszel-agent/beszel-agent update"
ignore_errors: true
- name: Restart services
ansible.builtin.systemd_service:
name: "{{ item }}"
state: restarted
with_items:
- beszel-agent
- beszel-hub
ignore_errors: true
register: metadata_restart_output
- name: Display update command output
debug:
msg: "{{ metadata_command_output.stdout }}"
- name: Display restart command output
debug:
msg: "{{ metadata_restart_output.stdout }}"
It upgraded the service successfully on my end:
root@h-MU-forgejo-prod:~# /opt/beszel-agent/beszel-agent update
beszel-agent 0.7.4
Checking for updates...
Latest version: 0.7.4
You are up to date
Thanks for sharing your code.
Does it show the correct version in the Beszel dashboard after you update? This is the issue I have when i run mine.
Thanks for sharing your code.
Does it show the correct version in the Beszel dashboard after you update? This is the issue I have when i run mine.
OHH yeah.. It takes a few mins (or seconds) to show up.
The agent version should update in the hub within one minute after successful update / restart of the agent.
Make sure you restart the beszel-agent service if the update was successful. Otherwise the same process with the prior version continues to run.
I added an option for automatic daily updates to the install script. It checks the output for "Successfully updated" and runs sudo systemctl restart beszel-agent
if there is a match.
I don't use Ansible but hopefully that helps.
Thank you @raifcoonjah, @henrygd.
I have an ansible script that updates the beszel agent on 2 Proxmox VEs. The issue is that the version does not update in Beszel dashboard until I SSH in each proxmox and run the update command manually.
Running the update manually (after I run the ansible playbook), the output is: beszel-agent 0.7.4 Checking for updates... Latest version: 0.7.4 You are up to date
The agent version is then displayed correctly in Beszel dashboard.
My ansible playbook: update_beszel_pve.txt
The output from running the playbook:
msg: |- beszel-agent 0.7.3 Checking for updates... Latest version: 0.7.4
Updating from 0.7.3 to 0.7.4... Successfully updated to 0.7.4
The playbook can help @flo82 from https://github.com/henrygd/beszel/discussions/268