44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
---
|
||
# tasks file for proxmox
|
||
|
||
- name: Add Proxmox VE host as HA group
|
||
ansible.builtin.blockinfile:
|
||
path: /etc/pve/ha/groups.cfg
|
||
append_newline: true
|
||
prepend_newline: true
|
||
block: |
|
||
group: {{ proxmox_instance_node }}
|
||
nodes {{ proxmox_instance_node }}
|
||
nofailback 0
|
||
restricted 0
|
||
marker: "# {mark} {{ proxmox_instance_node }}"
|
||
become: true
|
||
delegate_to: "{{ proxmox_delegate_to }}"
|
||
|
||
- name: Add instance in HA
|
||
ansible.builtin.blockinfile:
|
||
path: /etc/pve/ha/resources.cfg
|
||
append_newline: true
|
||
prepend_newline: true
|
||
block: |
|
||
vm: {{ proxmox_instance_vmid }}
|
||
comment: {{ inventory_hostname }}
|
||
group {{ proxmox_instance_ha.group }}
|
||
max_restart {{ proxmox_instance_ha.max_restart }}
|
||
max_relocate {{ proxmox_instance_ha.max_relocate }}
|
||
state {{ proxmox_instance_ha.state }}
|
||
marker: "# {mark} {{ inventory_hostname }}"
|
||
become: true
|
||
delegate_to: "{{ proxmox_delegate_to }}"
|
||
|
||
- name: Add ansible managed header
|
||
ansible.builtin.lineinfile:
|
||
path: "{{ item }}"
|
||
line: "# Ansible managed"
|
||
insertafter: BOF
|
||
become: true
|
||
loop:
|
||
- /etc/pve/ha/groups.cfg
|
||
- /etc/pve/ha/resources.cfg
|
||
delegate_to: "{{ proxmox_delegate_to }}"
|