Updated deploy
This commit is contained in:
@@ -16,33 +16,55 @@
|
||||
|
||||
tasks:
|
||||
# ==========================================
|
||||
# PHASE 1: REPOSITORIES & LICENSING
|
||||
# PHASE 1: REPOSITORIES & LICENSING (PVE 9 / Trixie)
|
||||
# ==========================================
|
||||
- name: Apply Proxmox 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
|
||||
changed_when: "'successfully' in pve_key_result.stdout"
|
||||
|
||||
- name: Manage Proxmox Enterprise Repository
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/apt/sources.list.d/pve-enterprise.list
|
||||
regexp: '^#?deb https://enterprise.proxmox.com/debian/pve'
|
||||
line: "{{ '' if pve_enterprise_key | length > 0 else '#' }}deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise"
|
||||
state: present
|
||||
- name: Ensure Legacy .list Files are Removed (Prevent APT Duplicates)
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- /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
|
||||
ansible.builtin.apt_repository:
|
||||
repo: 'deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription'
|
||||
state: "{{ 'absent' if pve_enterprise_key | length > 0 else 'present' }}"
|
||||
filename: pve-no-subscription
|
||||
- name: Manage Proxmox Enterprise Repository (DEB822)
|
||||
ansible.builtin.deb822_repository:
|
||||
name: pve-enterprise
|
||||
types: deb
|
||||
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:
|
||||
name: linstor_repo
|
||||
when:
|
||||
- deploy_linstor | bool
|
||||
- not is_single_node | bool
|
||||
- not is_standalone | bool
|
||||
|
||||
# ==========================================
|
||||
# PHASE 2: UPDATES & NAG REMOVAL
|
||||
@@ -52,7 +74,6 @@
|
||||
update_cache: yes
|
||||
upgrade: dist
|
||||
autoremove: yes
|
||||
register: apt_upgrade
|
||||
|
||||
- name: Remove Proxmox Subscription Nag (JS Patch)
|
||||
ansible.builtin.replace:
|
||||
@@ -68,10 +89,16 @@
|
||||
- deploy_linstor | 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:
|
||||
msg: "Rebooting to apply new PVE Kernel updates"
|
||||
when: apt_upgrade.changed
|
||||
msg: "Rebooting node to apply new kernel/system updates"
|
||||
reboot_timeout: 600 # Wait up to 10 minutes for the server to return
|
||||
when: reboot_required_file.stat.exists
|
||||
|
||||
# ==========================================
|
||||
# PHASE 3: PROXMOX CLUSTERING
|
||||
|
||||
Reference in New Issue
Block a user