feat : Add ignore_errors, when condition, and reset fact; update script registration

This commit introduces new functionality to include error handling, conditional execution, and state reset in scripts. It also updates the script registration process to ensure compatibility with these changes.
This commit is contained in:
2025-12-16 19:55:28 +01:00
parent 8005cd5dd7
commit a08dfae843

View File

@@ -32,6 +32,8 @@
- name: Run uninstall script
ansible.builtin.shell: |
/usr/local/bin/pve-mod-gui-sensors.sh uninstall
ignore_errors: true
when: pve_mod_gui_sensors_installed | default(false)
- name: Wait for Proxmox Web GUI to be up
wait_for:
@@ -39,6 +41,10 @@
delay: 5
timeout: 60
- name: Reset install fact
ansible.builtin.set_fact:
pve_mod_gui_sensors_installed: null
- name: Run pve-mod-gui-sensors script with predefined answers
expect:
command: /usr/local/src/pve-mod-gui-sensors.sh install
@@ -47,6 +53,7 @@
'Display temperatures in Celsius \[C\] or Fahrenheit \[f\].*\(C/f\):.*': 'c'
'Enable UPS information\?.*\(y/N\):.*': 'n'
'Enable system information\?.*\(1/2/n\):.*': '2'
register: pve_mod_gui_sensors_installed
- name: Wait for Proxmox Web GUI to be up
wait_for: