Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
.ansible/
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Proxmox nag removal playbook
|
||||||
|
|
||||||
|
This playbook applies the same proxmox subscription nag patch pattern as the archived upstream task file:
|
||||||
|
|
||||||
|
- upstream reference: `https://raw.githubusercontent.com/ironicbadger/ansible-role-proxmox-nag-removal/refs/heads/master/tasks/remove-nag.yml`
|
||||||
|
|
||||||
|
Update the example hosts in `inventory.ini`, then run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook -i inventory.ini remove-proxmox-nag.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- it targets the `proxmox` inventory group
|
||||||
|
- it keeps a one-time remote backup at `proxmoxlib.js.bak`
|
||||||
|
- it also enables Ansible's `backup: true` on each replace operation
|
||||||
|
- it restarts `pveproxy` only if one of the replacements changes the file
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[proxmox]
|
||||||
|
bonnie ansible_host=192.168.10.2
|
||||||
|
rosie ansible_host=192.168.10.21
|
||||||
|
pbs ansible_host=192.168.10.20
|
||||||
|
cessna ansible_host=cessna.egfh.internal
|
||||||
|
yak ansible_host=yak.egfh.internal
|
||||||
|
pbs-egfh ansible_host=pbs.egfh.internal
|
||||||
|
|
||||||
|
[proxmox:vars]
|
||||||
|
ansible_user=root
|
||||||
|
ansible_ssh_common_args='-F /dev/null -o ControlMaster=auto -o ControlPersist=60s'
|
||||||
@@ -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