Skip to content

Commit fbf44c8

Browse files
laesimoncaron
andcommitted
Merge pull request #314 from simoncaron/feature/fixes-for-pve9
Proxmox VE 9 Configuration Fixes - adds deb822 repositories for PVE9 - introduces pve_repository role variable as part of refactoring for deb822 - fixes HA groups check condition for PVE9 Co-authored-by: Simon Caron <[email protected]>
1 parent 063781e commit fbf44c8

File tree

7 files changed

+92
-17
lines changed

7 files changed

+92
-17
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,12 @@ serially during a maintenance period.) It will also enable the IPMI watchdog.
386386
```
387387
[variable]: [default] #[description/purpose]
388388
pve_group: proxmox # host group that contains the Proxmox hosts to be clustered together
389+
# Proxmox repository configuration for PVE 9 and above
390+
pve_repository:
391+
uris: # List of URIs for the Proxmox repository
392+
suites: # List of suites for the Proxmox repository
393+
components: # List of components for the Proxmox repository
394+
# Proxmox repository configuration for PVE 8 and below
389395
pve_repository_line: "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" # apt-repository configuration - change to enterprise if needed (although TODO further configuration may be needed)
390396
pve_remove_subscription_warning: true # patches the subscription warning messages in proxmox if you are using the community edition
391397
pve_extra_packages: [] # Any extra packages you may want to install, e.g. ngrep
@@ -413,6 +419,12 @@ pve_zfs_enabled: no # Specifies whether or not to install and configure ZFS pack
413419
# pve_zfs_zed_email: "" # Should be set to an email to receive ZFS notifications
414420
pve_zfs_create_volumes: [] # List of ZFS Volumes to create (to use as PVE Storages). See section on Storage Management.
415421
pve_ceph_enabled: false # Specifies wheter or not to install and configure Ceph packages. See below for an example configuration.
422+
# Proxmox Ceph repository configuration for PVE 9 and above
423+
pve_ceph_repository:
424+
uris: # List of URIs for the Ceph repository
425+
suites: # List of suites for the Ceph repository
426+
components: # List of components for the Ceph repository
427+
# Proxmox Ceph repository configuration for PVE 8 and below
416428
pve_ceph_repository_line: "deb http://download.proxmox.com/debian/ceph-pacific bookworm main" # apt-repository configuration. Will be automatically set for 6.x and 7.x (Further information: https://pve.proxmox.com/wiki/Package_Repositories)
417429
pve_ceph_network: "{{ (ansible_default_ipv4.network +'/'+ ansible_default_ipv4.netmask) | ansible.utils.ipaddr('net') }}" # Ceph public network
418430
# pve_ceph_cluster_network: "" # Optional, if the ceph cluster network is different from the public network (see https://pve.proxmox.com/pve-docs/chapter-pveceph.html#pve_ceph_install_wizard)

defaults/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
---
22
# defaults file for ansible-role-proxmox
33
pve_group: proxmox
4+
pve_repository:
5+
uris: http://download.proxmox.com/debian/pve
6+
suites: "{{ ansible_distribution_release }}"
7+
components: pve-no-subscription
8+
# Repo configuration for Proxmox VE < 9
49
pve_repository_line: "deb http://download.proxmox.com/debian/pve {{ ansible_distribution_release }} pve-no-subscription"
510
pve_remove_subscription_warning: true
611
pve_extra_packages: []
@@ -28,6 +33,11 @@ pve_zfs_enabled: no
2833
# pve_zfs_zed_email: "email address for zfs events"
2934
pve_zfs_create_volumes: []
3035
pve_ceph_enabled: false
36+
pve_ceph_repository:
37+
uris: http://download.proxmox.com/debian/ceph-{{ pve_ceph_default_version }}
38+
suites: "{{ ansible_distribution_release }}"
39+
components: "{{ pve_ceph_debian_component }}"
40+
# Ceph Repo configuration for Proxmox VE < 9
3141
pve_ceph_repository_line: "deb http://download.proxmox.com/debian/ceph-{{ pve_ceph_default_version }} {{ ansible_distribution_release }} {{ pve_ceph_debian_component }}"
3242
pve_ceph_network: "{{ (ansible_default_ipv4.network +'/'+ ansible_default_ipv4.netmask) | ansible.utils.ipaddr('net') }}"
3343
pve_ceph_nodes: "{{ pve_group }}"

files/proxmox-release-trixie.gpg

1.16 KB
Binary file not shown.

tasks/main.yml

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@
120120
state: present
121121
when: "ansible_distribution_major_version | int < 12"
122122

123-
- name: Trust Proxmox' packaging key on Debian 12
123+
- name: Trust Proxmox' packaging key on Debian >= 12
124124
copy:
125125
src: "proxmox-release-{{ ansible_distribution_release }}.gpg"
126126
dest: "/etc/apt/trusted.gpg.d/proxmox-release-{{ ansible_distribution_release }}.gpg"
127127
mode: 0644
128-
when: "ansible_distribution_major_version | int == 12"
128+
when: "ansible_distribution_major_version | int >= 12"
129129

130130
- name: Remove os-prober package
131131
apt:
@@ -136,20 +136,55 @@
136136
when:
137137
- "'pve-no-subscription' in pve_repository_line"
138138

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"
153188

154189
- name: Run apt-get dist-upgrade on repository changes
155190
apt:

tasks/pve_cluster_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
proxmox_query:
8181
query: "/cluster/ha/groups"
8282
register: _ha_group_list
83-
when: "inventory_hostname == _init_node"
83+
when: "inventory_hostname == _init_node and pve_cluster_ha_groups | length > 0"
8484

8585
- name: Create PVE cluster HA groups
8686
command: >-

tasks/remove_enterprise_repos.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,17 @@
88
- "deb https://enterprise.proxmox.com/debian {{ ansible_distribution_release }} pve-enterprise"
99
- "deb https://enterprise.proxmox.com/debian/pve {{ ansible_distribution_release }} pve-enterprise"
1010
- "deb https://enterprise.proxmox.com/debian/ceph-quincy {{ ansible_distribution_release }} enterprise"
11+
when: "ansible_distribution_major_version | int <= 12"
12+
13+
- name: Remove automatically installed PVE Enterprise repo configuration
14+
ansible.builtin.deb822_repository:
15+
name: "{{ item.name }}"
16+
state: absent
17+
types: deb
18+
uris: "{{ item.uris }}"
19+
suites: "{{ ansible_distribution_release }}"
20+
components: "{{ item.components }}"
21+
loop:
22+
- { name: 'pve-enterprise', uris: 'https://enterprise.proxmox.com/debian/pve', components: ['pve-enterprise'] }
23+
- { name: 'ceph', uris: 'https://enterprise.proxmox.com/debian/{{ pve_ceph_debian_component }}', components: ['enterprise'] }
24+
when: "ansible_distribution_major_version | int > 12"

vars/debian-trixie.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
pve_ssh_ciphers: "aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],[email protected]"
3+
pve_ceph_default_version: squid
4+
pve_ceph_debian_component: no-subscription

0 commit comments

Comments
 (0)