77 lines
2.0 KiB
YAML
77 lines
2.0 KiB
YAML
---
|
|
# Common post-routines for PVE 8 and 9: subscription nag, HA, updates, reboot
|
|
|
|
- name: "Deploy subscription nag removal script"
|
|
ansible.builtin.template:
|
|
src: pve-remove-nag.sh.j2
|
|
dest: /usr/local/bin/pve-remove-nag.sh
|
|
owner: root
|
|
group: root
|
|
mode: '0755'
|
|
when: proxmox_disable_subscription_nag
|
|
|
|
- name: "Configure dpkg Post-Invoke hook to run nag removal script"
|
|
ansible.builtin.copy:
|
|
dest: /etc/apt/apt.conf.d/no-nag-script
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
content: |
|
|
DPkg::Post-Invoke { "/usr/local/bin/pve-remove-nag.sh"; };
|
|
when: proxmox_disable_subscription_nag
|
|
|
|
- name: "Remove subscription nag dpkg hook if disabled via vars"
|
|
ansible.builtin.file:
|
|
path: /etc/apt/apt.conf.d/no-nag-script
|
|
state: absent
|
|
when: not proxmox_disable_subscription_nag
|
|
|
|
- name: "Ensure proxmox-widget-toolkit is reinstalled (like script)"
|
|
ansible.builtin.apt:
|
|
name: proxmox-widget-toolkit
|
|
state: latest
|
|
update_cache: false
|
|
force: true
|
|
register: proxmox_widget_reinstall
|
|
failed_when: false
|
|
|
|
- name: "Optionally enable HA services on cluster nodes"
|
|
ansible.builtin.service:
|
|
name: "{{ item }}"
|
|
state: started
|
|
enabled: true
|
|
loop:
|
|
- pve-ha-lrm
|
|
- pve-ha-crm
|
|
- corosync
|
|
when: proxmox_enable_ha
|
|
|
|
- name: "Optionally disable HA services on single-node setups"
|
|
ansible.builtin.service:
|
|
name: "{{ item }}"
|
|
state: stopped
|
|
enabled: false
|
|
loop:
|
|
- pve-ha-lrm
|
|
- pve-ha-crm
|
|
when: proxmox_disable_ha_on_single_node
|
|
|
|
- name: "Optionally disable Corosync on single-node setups"
|
|
ansible.builtin.service:
|
|
name: corosync
|
|
state: stopped
|
|
enabled: false
|
|
when: proxmox_disable_corosync_on_single_node
|
|
|
|
- name: "Run apt dist-upgrade (like original script)"
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
upgrade: dist
|
|
when: proxmox_run_dist_upgrade
|
|
|
|
- name: "Reboot Proxmox VE when requested"
|
|
ansible.builtin.reboot:
|
|
msg: "Rebooting after post-install routines (Ansible)."
|
|
reboot_timeout: 1800
|
|
when: proxmox_reboot_after
|