From 9b23b70793309021172418f76d53c99e9fcddd29 Mon Sep 17 00:00:00 2001 From: Quotengrote <38253905+quotengrote@users.noreply.github.com> Date: Mon, 24 Aug 2020 20:07:39 +0200 Subject: [PATCH] Ersetze mgrote.pve-nag-buster --> ironicbadger.proxmox-nag-removal (#12) --- playbooks/service/pve.yml | 2 +- .../README.md | 5 +++ .../defaults/main.yml | 4 ++ .../handlers/main.yml | 6 +++ .../meta/main.yml | 14 +++++++ .../tasks/main.yml | 9 +++++ .../tasks/remove-enterprise-repo.yml | 6 +++ .../tasks/remove-nag.yml | 14 +++++++ roles/mgrote.pve_nag-buster/README.md | 11 ----- roles/mgrote.pve_nag-buster/defaults/main.yml | 1 - roles/mgrote.pve_nag-buster/handlers/main.yml | 0 roles/mgrote.pve_nag-buster/tasks/main.yml | 40 ------------------- 12 files changed, 59 insertions(+), 53 deletions(-) create mode 100644 roles/ironicbadger.proxmox-nag-removal/README.md create mode 100644 roles/ironicbadger.proxmox-nag-removal/defaults/main.yml create mode 100644 roles/ironicbadger.proxmox-nag-removal/handlers/main.yml create mode 100644 roles/ironicbadger.proxmox-nag-removal/meta/main.yml create mode 100644 roles/ironicbadger.proxmox-nag-removal/tasks/main.yml create mode 100644 roles/ironicbadger.proxmox-nag-removal/tasks/remove-enterprise-repo.yml create mode 100644 roles/ironicbadger.proxmox-nag-removal/tasks/remove-nag.yml delete mode 100644 roles/mgrote.pve_nag-buster/README.md delete mode 100644 roles/mgrote.pve_nag-buster/defaults/main.yml delete mode 100644 roles/mgrote.pve_nag-buster/handlers/main.yml delete mode 100644 roles/mgrote.pve_nag-buster/tasks/main.yml diff --git a/playbooks/service/pve.yml b/playbooks/service/pve.yml index 2b0c693f..9c2cc1e8 100644 --- a/playbooks/service/pve.yml +++ b/playbooks/service/pve.yml @@ -1,7 +1,7 @@ --- - hosts: virt roles: - - { role: mgrote.pve_nag-buster, tags: "nag-buster" } + - { role: ironicbadger.proxmox-nag-removal, tags: "nag", become: yes } - { role: mgrote.apcupsd, tags: "apcupsd" } - { role: mgrote.smart, tags: "smart" } - { role: mgrote.zfs_tools, tags: "zfs_tools" } diff --git a/roles/ironicbadger.proxmox-nag-removal/README.md b/roles/ironicbadger.proxmox-nag-removal/README.md new file mode 100644 index 00000000..ed5dd9cb --- /dev/null +++ b/roles/ironicbadger.proxmox-nag-removal/README.md @@ -0,0 +1,5 @@ +# ironicbadger/ansible-role-proxmox-nag-removal + +This role removes the obnoxious Proxmox 'please subscribe' dialog box from a non subscribed server. It will also by default ensure that the enterprise repos are disabled. + +Tested and working with Proxmo 5.4-4. \ No newline at end of file diff --git a/roles/ironicbadger.proxmox-nag-removal/defaults/main.yml b/roles/ironicbadger.proxmox-nag-removal/defaults/main.yml new file mode 100644 index 00000000..86327f16 --- /dev/null +++ b/roles/ironicbadger.proxmox-nag-removal/defaults/main.yml @@ -0,0 +1,4 @@ +--- + +remove_nag: True +remove_enterprise_repo: True \ No newline at end of file diff --git a/roles/ironicbadger.proxmox-nag-removal/handlers/main.yml b/roles/ironicbadger.proxmox-nag-removal/handlers/main.yml new file mode 100644 index 00000000..40fdea31 --- /dev/null +++ b/roles/ironicbadger.proxmox-nag-removal/handlers/main.yml @@ -0,0 +1,6 @@ +--- + +- name: restart pveproxy + service: + name: pveproxy + state: restarted \ No newline at end of file diff --git a/roles/ironicbadger.proxmox-nag-removal/meta/main.yml b/roles/ironicbadger.proxmox-nag-removal/meta/main.yml new file mode 100644 index 00000000..dab73f90 --- /dev/null +++ b/roles/ironicbadger.proxmox-nag-removal/meta/main.yml @@ -0,0 +1,14 @@ +--- +galaxy_info: + author: Alex Kretzschmar + description: Removes Proxmox nag screen + issue_tracker_url: https://github.com/ironicbadger/ansible-role-proxmox-nag-removal/issues + license: GPLv2 + min_ansible_version: 2.7 + platforms: + - name: Debian + versions: + - all + categories: + - system + - web \ No newline at end of file diff --git a/roles/ironicbadger.proxmox-nag-removal/tasks/main.yml b/roles/ironicbadger.proxmox-nag-removal/tasks/main.yml new file mode 100644 index 00000000..09bcfcff --- /dev/null +++ b/roles/ironicbadger.proxmox-nag-removal/tasks/main.yml @@ -0,0 +1,9 @@ +--- + +- name: removes subscription nag box + include: remove-nag.yml + when: remove_nag + +- name: remove enterprise repos + include: remove-enterprise-repo.yml + when: remove_enterprise_repo diff --git a/roles/ironicbadger.proxmox-nag-removal/tasks/remove-enterprise-repo.yml b/roles/ironicbadger.proxmox-nag-removal/tasks/remove-enterprise-repo.yml new file mode 100644 index 00000000..0cba8ed7 --- /dev/null +++ b/roles/ironicbadger.proxmox-nag-removal/tasks/remove-enterprise-repo.yml @@ -0,0 +1,6 @@ +--- + +- name: Ensure enterprise repo file is not present + file: + path: /etc/apt/sources.list.d/pve-enterprise.list + state: absent diff --git a/roles/ironicbadger.proxmox-nag-removal/tasks/remove-nag.yml b/roles/ironicbadger.proxmox-nag-removal/tasks/remove-nag.yml new file mode 100644 index 00000000..abeec0e3 --- /dev/null +++ b/roles/ironicbadger.proxmox-nag-removal/tasks/remove-nag.yml @@ -0,0 +1,14 @@ +--- + +- name: backup up original file + copy: + remote_src: True + src: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js + dest: "/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.bak-{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + +- name: modify line which performs license check + replace: + path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js + regexp: "data.status \\!== \\'Active\\'" + replace: "false" + notify: restart pveproxy \ No newline at end of file diff --git a/roles/mgrote.pve_nag-buster/README.md b/roles/mgrote.pve_nag-buster/README.md deleted file mode 100644 index ae7e8548..00000000 --- a/roles/mgrote.pve_nag-buster/README.md +++ /dev/null @@ -1,11 +0,0 @@ -## mgrote.pve_nag-buster - -### Beschreibung -Laedt das Script "pve_nag-buster" gerunter und fuehrt es aus. - -### Funktioniert auf -- [x] ProxMox 6.1 - -### Variablen -##### Bei jedem Lauf Update durchführen? -pve_nag_buster_update: false diff --git a/roles/mgrote.pve_nag-buster/defaults/main.yml b/roles/mgrote.pve_nag-buster/defaults/main.yml deleted file mode 100644 index 49c4fac9..00000000 --- a/roles/mgrote.pve_nag-buster/defaults/main.yml +++ /dev/null @@ -1 +0,0 @@ -pve_nag_buster_update: false diff --git a/roles/mgrote.pve_nag-buster/handlers/main.yml b/roles/mgrote.pve_nag-buster/handlers/main.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/roles/mgrote.pve_nag-buster/tasks/main.yml b/roles/mgrote.pve_nag-buster/tasks/main.yml deleted file mode 100644 index e043f598..00000000 --- a/roles/mgrote.pve_nag-buster/tasks/main.yml +++ /dev/null @@ -1,40 +0,0 @@ - - name: check if updates should be applied - become: yes - stat: - path: "/root/pve-nag-buster/is_installed" - register: "is_installed" - -# - name: dbug -# debug: -# msg: "{{ is_installed }}" - -# - set_fact: is_installed.stat.exists = false -# when: pve_nag_buster_update == true - - - name: create "/root/pve-nag-buster" - become: yes - file: - path: /root/pve-nag-buster - state: directory - when: (not is_installed.stat.exists) or (pve_nag_buster_update) - - - name: download nag-buster-script - become: yes - get_url: - url: https://raw.githubusercontent.com/foundObjects/pve-nag-buster/master/install.sh - dest: /root/pve-nag-buster/install.sh - mode: 775 - when: (not is_installed.stat.exists) or (pve_nag_buster_update) - - - name: execute script - become: yes - command: /root/pve-nag-buster/install.sh - when: (not is_installed.stat.exists) or (pve_nag_buster_update) - - - name: touch "update" - become: yes - file: - path: /root/pve-nag-buster/is_installed - state: touch - access_time: preserve - modification_time: preserve