Files
ansible_role_proxmox_provision/tasks/repos.yml
Jose b42e72a835
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
refactor ♻️: Refactor Proxmox repo management tasks, add comments, and ensure apt update is triggered on changes.
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.
2026-02-09 18:07:22 +01:00

51 lines
1.6 KiB
YAML

---
- name: repos | Manage Proxmox repositories
vars:
repo_path:
- http://download\.proxmox\.com/debian/pve\
block:
# Proxmox enterprise repo
- name: repos | Check for Proxmox enterprise repo file
ansible.builtin.stat:
path: /etc/apt/sources.list.d/pve-enterprise.list
register: pve_enterprise_repo
- name: repos | Comment out Proxmox enterprise repo lines
ansible.builtin.replace:
path: /etc/apt/sources.list.d/pve-enterprise.list
regexp: '^\s*deb\s+'
replace: '# deb '
when: pve_enterprise_repo.stat.exists
notify: Run apt update
# Proxmox no-subscription repo
- name: repos | Check for pve-install-repo.list
ansible.builtin.stat:
path: /etc/apt/sources.list.d/pve-install-repo.list
register: pve_install_repo
- name: repos | Uncomment Proxmox no-subscription repo if present
ansible.builtin.replace:
path: /etc/apt/sources.list.d/pve-install-repo.list
regexp: '^\s*#\s*(deb\s+.*pve-no-subscription)'
replace: '\1'
when: pve_install_repo.stat.exists
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: '^\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
notify: Run apt update