diff --git a/files/pve-remove-nag.sh b/files/pve-remove-nag.sh
new file mode 100644
index 0000000..519e3b2
--- /dev/null
+++ b/files/pve-remove-nag.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# source: https://github.com/community-scripts/ProxmoxVE/blob/main/tools/pve/post-pve-install.sh
+# Commit c464b95
+
+WEB_JS=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
+if [ -s "$WEB_JS" ] && ! grep -q NoMoreNagging "$WEB_JS"; then
+ echo "Patching Web UI nag..."
+ sed -i \
+ -e "/data\.status/ s/!//" \
+ -e "/data\.status/ s/active/NoMoreNagging/" \
+ "$WEB_JS"
+fi
+
+MOBILE_TPL=/usr/share/pve-yew-mobile-gui/index.html.tpl
+MARKER=""
+if [ -f "$MOBILE_TPL" ] && ! grep -q "$MARKER" "$MOBILE_TPL"; then
+ echo "Patching Mobile UI nag..."
+ cat <<'EOF' >> "$MOBILE_TPL"
+
+
+EOF
+fi
diff --git a/handlers/main.yml b/handlers/main.yml
index b5cff37..e48a179 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -15,6 +15,6 @@
ansible.builtin.systemd_service:
daemon_reexec: true
-- name: logrotate reload
+- name: Logrotate reload
ansible.builtin.command: logrotate /etc/logrotate.conf
changed_when: false
diff --git a/tasks/logrotate.yml b/tasks/logrotate.yml
index aa385a8..355835f 100644
--- a/tasks/logrotate.yml
+++ b/tasks/logrotate.yml
@@ -13,98 +13,99 @@
block:
- - name: Check if {{ item }} exists
+ - name: logrotate | Check if exists {{ item }}
ansible.builtin.stat:
path: "{{ item }}"
register: logrotate_file
- - name: Configure {{ item }}
+ - name: logrotate | Configure {{ item }}
+ when: logrotate_file.stat.exists
block:
- - name: Backup {{ item }} once
+ - name: logrotate | Backup once {{ item }}
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ item }}.original"
+ owner: root
+ group: root
+ mode: "0644"
remote_src: true
args:
creates: "{{ item }}.original"
- - name: Ensure daily rotation
+ - name: logrotate | Ensure daily rotation
ansible.builtin.replace:
path: "{{ item }}"
regexp: '^\s*weekly'
replace: 'daily'
- notify: logrotate reload
+ notify: Logrotate reload
- - name: Set rotate (number of retained logs)
+ - name: logrotate | Set rotate (number of retained logs)
ansible.builtin.lineinfile:
path: "{{ item }}"
regexp: '^(\s*rotate\s+).*'
line: ' rotate {{ proxmox_logrotate_rotate }}'
state: present
insertafter: '^\s*daily'
- notify: logrotate reload
+ notify: Logrotate reload
- - name: Ensure maxsize is set
+ - name: logrotate | Ensure maxsize is set
ansible.builtin.lineinfile:
path: "{{ item }}"
regexp: '^(\s*maxsize\s+).*'
line: ' maxsize {{ proxmox_logrotate_maxsize }}'
state: present
insertafter: '^\s*rotate'
- notify: logrotate reload
+ notify: Logrotate reload
- - name: Ensure Compress
+ - name: logrotate | Ensure Compress
ansible.builtin.lineinfile:
path: "{{ item }}"
regexp: '^\s*compress\b'
line: ' compress'
state: present
insertafter: '^\s*maxsize'
- notify: logrotate reload
+ notify: Logrotate reload
- - name: Ensure delaycompress
+ - name: logrotate | Ensure delaycompress
ansible.builtin.lineinfile:
path: "{{ item }}"
regexp: '^\s*delaycompress\b'
line: ' delaycompress'
state: present
insertafter: '^\s*compress'
- notify: logrotate reload
-
- when: logrotate_file.stat.exists
-
+ notify: Logrotate reload
# only for logrotate.conf
-- name: Uncomment dateext if commented
+- name: logrotate | Uncomment dateext if commented
ansible.builtin.replace:
path: /etc/logrotate.conf
regexp: '^\s*#\s*(dateext)\b'
replace: '\1'
- notify: logrotate reload
+ notify: Logrotate reload
-- name: Uncomment compress if commented
+- name: logrotate | Uncomment compress if commented
ansible.builtin.replace:
path: /etc/logrotate.conf
regexp: '^\s*#\s*(compress)\b'
replace: '\1'
- notify: logrotate reload
+ notify: Logrotate reload
-- name: Ensure missingok is present
+- name: logrotate | Ensure missingok is present
ansible.builtin.lineinfile:
path: /etc/logrotate.conf
regexp: '^\s*missingok\b'
line: 'missingok'
state: present
insertafter: EOF
- notify: logrotate reload
+ notify: Logrotate reload
-- name: Ensure notifempty is present
+- name: logrotate | Ensure notifempty is present
ansible.builtin.lineinfile:
path: /etc/logrotate.conf
regexp: '^\s*notifempty\b'
line: 'notifempty'
state: present
insertafter: EOF
- notify: logrotate reload
+ notify: Logrotate reload
diff --git a/tasks/repos.yml b/tasks/repos.yml
index 0a619a2..bf1af82 100644
--- a/tasks/repos.yml
+++ b/tasks/repos.yml
@@ -16,10 +16,10 @@
- name: repos | Comment out Proxmox enterprise repo lines
ansible.builtin.replace:
path: /etc/apt/sources.list.d/pve-enterprise.list
- regexp: '^(deb\s+)'
- replace: '# \1'
+ regexp: '^\s*deb\s+'
+ replace: '# deb '
when: pve_enterprise_repo.stat.exists
- register: enterprise_changed
+ notify: Run apt update
# Proxmox no-subscription repo
@@ -31,23 +31,20 @@
- name: repos | Uncomment Proxmox no-subscription repo if present
ansible.builtin.replace:
path: /etc/apt/sources.list.d/pve-install-repo.list
- regexp: '^#\s*(deb\s+{{ repo_path }}s+{{ ansible_distribution_release }}\s+pve-no-subscription)'
+ regexp: '^\s*#\s*(deb\s+.*pve-no-subscription)'
replace: '\1'
when: pve_install_repo.stat.exists
- register: no_sub_uncommented
+ notify: Run apt update
- name: repos | Add Proxmox no-subscription repo if missing
ansible.builtin.lineinfile:
path: /etc/apt/sources.list.d/pve-install-repo.list
- regexp: '^deb\s+{{ repo_path }}s+{{ ansible_distribution_release }}\s+pve-no-subscription$'
- line: "deb http://download.proxmox.com/debian/pve {{ ansible_distribution_release }} pve-no-subscription"
+ regexp: '^\s*deb\s+.*pve-no-subscription\s*$'
+ line: >-
+ deb http://download.proxmox.com/debian/pve
+ {{ ansible_distribution_release }}
+ pve-no-subscription
state: present
insertafter: EOF
when: pve_install_repo.stat.exists
- register: no_sub_added
-
- # Notify Run apt update only once if any of the above tasks changed something
- notify:
- - Run apt update
- # Trigger only if any changes occurred
- when: enterprise_changed.changed or no_sub_uncommented.changed or no_sub_added.changed
+ notify: Run apt update
diff --git a/tasks/subscription.yml b/tasks/subscription.yml
index ba8750e..83c0dbf 100644
--- a/tasks/subscription.yml
+++ b/tasks/subscription.yml
@@ -1,5 +1,5 @@
---
-- name: Ensure /usr/local/bin exists
+- name: subscription | Ensure /usr/local/bin exists
ansible.builtin.file:
path: /usr/local/bin
state: directory
@@ -12,63 +12,16 @@
path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
register: proxmoxlib_js
-- name: Install pve-remove-nag script
+- name: subscription | Install pve-remove-nag script
ansible.builtin.copy:
+ src: pve-remove-nag.sh
dest: /usr/local/bin/pve-remove-nag.sh
owner: root
group: root
mode: "0755"
- content: |
- #!/bin/sh
- # source: https://github.com/community-scripts/ProxmoxVE/blob/main/tools/pve/post-pve-install.sh
- # Commit c464b95
- WEB_JS=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
- if [ -s "$WEB_JS" ] && ! grep -q NoMoreNagging "$WEB_JS"; then
- echo "Patching Web UI nag..."
- sed -i -e "/data\.status/ s/!//" -e "/data\.status/ s/active/NoMoreNagging/" "$WEB_JS"
- fi
-
- MOBILE_TPL=/usr/share/pve-yew-mobile-gui/index.html.tpl
- MARKER=""
- if [ -f "$MOBILE_TPL" ] && ! grep -q "$MARKER" "$MOBILE_TPL"; then
- echo "Patching Mobile UI nag..."
- printf "%s\n" \
- "$MARKER" \
- "" \
- "" >> "$MOBILE_TPL"
- fi
when: proxmoxlib_js.stat.exists
-- name: Install APT post-invoke hook for nag removal
+- name: subscription | Install APT post-invoke hook for nag removal
ansible.builtin.copy:
dest: /etc/apt/apt.conf.d/no-nag-script
owner: root
diff --git a/templates/logrotate-pve.j2 b/templates/logrotate-pve.j2
deleted file mode 100644
index 6d78e57..0000000
--- a/templates/logrotate-pve.j2
+++ /dev/null
@@ -1,13 +0,0 @@
-/var/log/pve/*.log /var/log/pve/tasks/*.log {
- daily
- rotate {{ proxmox_logrotate_rotate }}
- compress
- missingok
- notifempty
- maxsize {{ proxmox_logrotate_maxsize }}
- create 0640 root adm
- sharedscripts
- postrotate
- systemctl reload rsyslog >/dev/null 2>&1 || true
- endscript
-}