refactor ♻️: Refactor Proxmox repo management tasks, add comments, and ensure apt update is triggered on changes.
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 7s
Gitleaks Scan / gitleaks (push) Successful in 5s
Markdown Lint / markdown-lint (push) Successful in 5s

This commit refactors the Proxmox repository management tasks by adding necessary comments for better understanding. It also ensures that `apt update` is triggered whenever there are changes to the repository configuration.
This commit is contained in:
2026-02-09 18:07:22 +01:00
parent ae15b76575
commit b42e72a835
2 changed files with 11 additions and 27 deletions

View File

@@ -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

View File

@@ -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
}