Files
ansible_role_proxmox_provision/tasks/subscription.yml
Jose bb7835c350
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 11s
Gitleaks Scan / gitleaks (push) Successful in 5s
Markdown Lint / markdown-lint (push) Failing after 5s
refactor ♻️: Refactor subscription task to check and remove nag messages
This refactoring ensures that the subscription task properly checks for and removes nag messages in both legacy and minified JavaScript files, enhancing robustness by handling cases where files may not exist.

 No silent failures
 Safe if file doesn’t exist
 Hard fail if Proxmox changes the JS logic and the patch no longer applies
 Clear signal that the role needs updating after a major upgrade
2026-02-07 09:24:46 +01:00

35 lines
1.1 KiB
YAML

---
- name: subscription | Check for legacy proxmoxlib.js
stat:
path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
register: proxmoxlib_js
- name: subscription | Remove subscription nag (legacy proxmoxlib.js)
ansible.builtin.replace:
path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
regexp: "if \\(data.status !== 'Active'\\)"
replace: "if (false)"
when: proxmoxlib_js.stat.exists
register: patch_legacy
failed_when:
- proxmoxlib_js.stat.exists
- patch_legacy.matched == 0
notify: restart pveproxy
- name: subscription | Check for minified proxmoxlib.min.js (VE 8/9)
stat:
path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js
register: proxmoxlib_min_js
- name: subscription | Remove subscription nag (minified bundle for VE 8/9)
ansible.builtin.replace:
path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js
regexp: "data.status!=='Active'"
replace: "false"
when: proxmoxlib_min_js.stat.exists
register: patch_minified
failed_when:
- proxmoxlib_min_js.stat.exists
- patch_minified.matched == 0
notify: restart pveproxy