Updated deploy

This commit is contained in:
Francesco Zimbolo
2026-04-23 09:11:35 +00:00
parent 2cb457964c
commit 9e294aea1a

View File

@@ -16,33 +16,55 @@
tasks: tasks:
# ========================================== # ==========================================
# PHASE 1: REPOSITORIES & LICENSING # PHASE 1: REPOSITORIES & LICENSING (PVE 9 / Trixie)
# ========================================== # ==========================================
- name: Apply Proxmox Enterprise Key - name: Apply Proxmox Enterprise Key
ansible.builtin.command: pvesubscription set -k {{ pve_enterprise_key }} ansible.builtin.command: pvesubscription set -k {{ pve_enterprise_key }}
when: pve_enterprise_key | length > 0 when: pve_enterprise_key | default('') | length > 0
register: pve_key_result register: pve_key_result
changed_when: "'successfully' in pve_key_result.stdout" changed_when: "'successfully' in pve_key_result.stdout"
- name: Manage Proxmox Enterprise Repository - name: Ensure Legacy .list Files are Removed (Prevent APT Duplicates)
ansible.builtin.lineinfile: ansible.builtin.file:
path: /etc/apt/sources.list.d/pve-enterprise.list path: "{{ item }}"
regexp: '^#?deb https://enterprise.proxmox.com/debian/pve' state: absent
line: "{{ '' if pve_enterprise_key | length > 0 else '#' }}deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise" loop:
state: present - /etc/apt/sources.list.d/pve-enterprise.list
- /etc/apt/sources.list.d/pve-no-subscription.list
- /etc/apt/sources.list.d/ceph.list
- name: Manage Proxmox No-Subscription Repository - name: Manage Proxmox Enterprise Repository (DEB822)
ansible.builtin.apt_repository: ansible.builtin.deb822_repository:
repo: 'deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription' name: pve-enterprise
state: "{{ 'absent' if pve_enterprise_key | length > 0 else 'present' }}" types: deb
filename: pve-no-subscription uris: https://enterprise.proxmox.com/debian/pve
suites: trixie
components: pve-enterprise
signed_by: /usr/share/keyrings/proxmox-archive-keyring.gpg
state: "{{ 'present' if pve_enterprise_key | default('') | length > 0 else 'absent' }}"
- name: Add Linstor Repositories (Skipped in Single Node) - name: Manage Proxmox No-Subscription Repository (DEB822)
ansible.builtin.deb822_repository:
name: pve-no-subscription
types: deb
uris: http://download.proxmox.com/debian/pve
suites: trixie
components: pve-no-subscription
signed_by: /usr/share/keyrings/proxmox-archive-keyring.gpg
state: "{{ 'absent' if pve_enterprise_key | default('') | length > 0 else 'present' }}"
- name: Remove Ceph Enterprise Repository (Unused in Linstor)
ansible.builtin.file:
path: /etc/apt/sources.list.d/ceph.sources
state: absent
when: pve_enterprise_key | default('') | length == 0
- name: Add Linstor Repositories (Skipped in Standalone Node)
ansible.builtin.include_role: ansible.builtin.include_role:
name: linstor_repo name: linstor_repo
when: when:
- deploy_linstor | bool - deploy_linstor | bool
- not is_single_node | bool - not is_standalone | bool
# ========================================== # ==========================================
# PHASE 2: UPDATES & NAG REMOVAL # PHASE 2: UPDATES & NAG REMOVAL
@@ -52,7 +74,6 @@
update_cache: yes update_cache: yes
upgrade: dist upgrade: dist
autoremove: yes autoremove: yes
register: apt_upgrade
- name: Remove Proxmox Subscription Nag (JS Patch) - name: Remove Proxmox Subscription Nag (JS Patch)
ansible.builtin.replace: ansible.builtin.replace:
@@ -68,10 +89,16 @@
- deploy_linstor | bool - deploy_linstor | bool
- not is_single_node | bool - not is_single_node | bool
- name: Reboot if kernel was updated - name: Check if a reboot is required by APT
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required_file
- name: Reboot the node gracefully
ansible.builtin.reboot: ansible.builtin.reboot:
msg: "Rebooting to apply new PVE Kernel updates" msg: "Rebooting node to apply new kernel/system updates"
when: apt_upgrade.changed reboot_timeout: 600 # Wait up to 10 minutes for the server to return
when: reboot_required_file.stat.exists
# ========================================== # ==========================================
# PHASE 3: PROXMOX CLUSTERING # PHASE 3: PROXMOX CLUSTERING