|
120 | 120 | state: present
|
121 | 121 | when: "ansible_distribution_major_version | int < 12"
|
122 | 122 |
|
123 |
| -- name: Trust Proxmox' packaging key on Debian 12 |
| 123 | +- name: Trust Proxmox' packaging key on Debian >= 12 |
124 | 124 | copy:
|
125 | 125 | src: "proxmox-release-{{ ansible_distribution_release }}.gpg"
|
126 | 126 | dest: "/etc/apt/trusted.gpg.d/proxmox-release-{{ ansible_distribution_release }}.gpg"
|
127 | 127 | mode: 0644
|
128 |
| - when: "ansible_distribution_major_version | int == 12" |
| 128 | + when: "ansible_distribution_major_version | int >= 12" |
129 | 129 |
|
130 | 130 | - name: Remove os-prober package
|
131 | 131 | apt:
|
|
136 | 136 | when:
|
137 | 137 | - "'pve-no-subscription' in pve_repository_line"
|
138 | 138 |
|
139 |
| -- name: Add Proxmox repository |
140 |
| - apt_repository: |
141 |
| - repo: "{{ pve_repository_line }}" |
142 |
| - filename: proxmox |
143 |
| - state: present |
144 |
| - register: _pve_repo |
145 |
| - |
146 |
| -- name: Add Proxmox Ceph repository |
147 |
| - apt_repository: |
148 |
| - repo: '{{ pve_ceph_repository_line }}' |
149 |
| - filename: ceph |
150 |
| - state: present |
151 |
| - register: _pve_ceph_repo |
152 |
| - when: "pve_ceph_enabled | bool" |
| 139 | +- name: Manage apt repositories |
| 140 | + block: |
| 141 | + - name: Add Proxmox repository |
| 142 | + ansible.builtin.apt_repository: |
| 143 | + repo: "{{ pve_repository_line }}" |
| 144 | + filename: proxmox |
| 145 | + state: present |
| 146 | + register: _pve_repo |
| 147 | + |
| 148 | + - name: Add Proxmox Ceph repository |
| 149 | + ansible.builtin.apt_repository: |
| 150 | + repo: '{{ pve_ceph_repository_line }}' |
| 151 | + filename: ceph |
| 152 | + state: present |
| 153 | + register: _pve_ceph_repo |
| 154 | + when: "pve_ceph_enabled | bool" |
| 155 | + when: "ansible_distribution_major_version | int <= 12" |
| 156 | + |
| 157 | +- name: Manage deb822 repositories |
| 158 | + block: |
| 159 | + - name: Add Proxmox repository |
| 160 | + ansible.builtin.deb822_repository: |
| 161 | + name: proxmox |
| 162 | + types: deb |
| 163 | + uris: "{{ pve_repository.uris }}" |
| 164 | + suites: "{{ pve_repository.suites }}" |
| 165 | + components: "{{ pve_repository.components }}" |
| 166 | + signed_by: /etc/apt/trusted.gpg.d/proxmox-release-{{ ansible_distribution_release }}.gpg |
| 167 | + state: present |
| 168 | + register: _pve_repo |
| 169 | + |
| 170 | + - name: Add Proxmox Ceph repository |
| 171 | + ansible.builtin.deb822_repository: |
| 172 | + name: ceph |
| 173 | + types: deb |
| 174 | + uris: "{{ pve_ceph_repository.uris }}" |
| 175 | + suites: "{{ pve_ceph_repository.suites }}" |
| 176 | + components: "{{ pve_ceph_repository.components }}" |
| 177 | + signed_by: /etc/apt/trusted.gpg.d/proxmox-release-{{ ansible_distribution_release }}.gpg |
| 178 | + state: present |
| 179 | + register: _pve_ceph_repo |
| 180 | + when: "pve_ceph_enabled | bool" |
| 181 | + |
| 182 | + - name: Update repositories cache |
| 183 | + ansible.builtin.apt: |
| 184 | + update_cache: yes |
| 185 | + when: _pve_repo is changed or _pve_ceph_repo is changed |
| 186 | + |
| 187 | + when: "ansible_distribution_major_version | int > 12" |
153 | 188 |
|
154 | 189 | - name: Run apt-get dist-upgrade on repository changes
|
155 | 190 | apt:
|
|
0 commit comments