Initial commit
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
---
|
||||
- name: Remove Proxmox subscription nag
|
||||
hosts: proxmox
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
vars:
|
||||
proxmox_widget_toolkit_path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
|
||||
proxmox_widget_toolkit_backup_path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.bak
|
||||
|
||||
handlers:
|
||||
- name: Restart web proxy
|
||||
ansible.builtin.service:
|
||||
name: "{{ proxmox_proxy_service }}"
|
||||
state: restarted
|
||||
|
||||
tasks:
|
||||
- name: Gather service facts
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
- name: Select proxy service
|
||||
ansible.builtin.set_fact:
|
||||
proxmox_proxy_service: >-
|
||||
{{
|
||||
'pveproxy'
|
||||
if 'pveproxy.service' in ansible_facts.services
|
||||
else 'proxmox-backup-proxy'
|
||||
if 'proxmox-backup-proxy.service' in ansible_facts.services
|
||||
else ''
|
||||
}}
|
||||
|
||||
- name: Fail when no supported proxy service is present
|
||||
ansible.builtin.fail:
|
||||
msg: "Neither pveproxy nor proxmox-backup-proxy is installed on the remote host."
|
||||
when: proxmox_proxy_service == ''
|
||||
|
||||
- name: Check proxmoxlib.js exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ proxmox_widget_toolkit_path }}"
|
||||
register: proxmoxlib_stat
|
||||
|
||||
- name: Fail when proxmoxlib.js is missing
|
||||
ansible.builtin.fail:
|
||||
msg: "{{ proxmox_widget_toolkit_path }} was not found on the remote host."
|
||||
when: not proxmoxlib_stat.stat.exists
|
||||
|
||||
- name: Preserve original proxmoxlib.js once
|
||||
ansible.builtin.copy:
|
||||
src: "{{ proxmox_widget_toolkit_path }}"
|
||||
dest: "{{ proxmox_widget_toolkit_backup_path }}"
|
||||
remote_src: true
|
||||
force: false
|
||||
mode: preserve
|
||||
|
||||
- name: Disable the subscription status check in proxmoxlib.js
|
||||
ansible.builtin.replace:
|
||||
path: "{{ proxmox_widget_toolkit_path }}"
|
||||
regexp: "res\\.data\\.status\\.toLowerCase\\(\\) !== 'active'"
|
||||
replace: "false"
|
||||
backup: true
|
||||
notify: Restart web proxy
|
||||
|
||||
- name: Disable the legacy subscription status check in proxmoxlib.js
|
||||
ansible.builtin.replace:
|
||||
path: "{{ proxmox_widget_toolkit_path }}"
|
||||
regexp: "data\\.status !== 'Active'"
|
||||
replace: "false"
|
||||
backup: true
|
||||
notify: Restart web proxy
|
||||
Reference in New Issue
Block a user