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.
63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
- name: Setup Proxmox
|
|
hosts: proxmox
|
|
become: true
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Ensure git is installed
|
|
ansible.builtin.apt:
|
|
pkg:
|
|
- git
|
|
- python3-proxmoxer
|
|
- lm-sensors
|
|
state: present
|
|
update_cache: yes
|
|
cache_valid_time: 3600
|
|
|
|
- name: Clone PVE-mods repository
|
|
ansible.builtin.git:
|
|
repo: "https://github.com/Meliox/PVE-mods.git"
|
|
dest: "/opt/PVE-mods"
|
|
version: "main"
|
|
update: yes
|
|
|
|
- name: Install pve-mod-gui-sensors.sh
|
|
ansible.builtin.copy:
|
|
src: "/opt/PVE-mods/pve-mod-gui-sensors.sh"
|
|
dest: "/usr/local/bin/pve-mod-gui-sensors.sh"
|
|
mode: "0755"
|
|
remote_src: yes
|
|
|
|
- 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:
|
|
port: 8006
|
|
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
|
|
responses:
|
|
'Display temperatures for all cores \[C\] or average per CPU \[a\].*\(C/a\):.*': 'a'
|
|
'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:
|
|
port: 8006
|
|
delay: 5
|
|
timeout: 60
|
|
|