fix: playbook execution order

This commit is contained in:
Simon Cornet 2025-11-16 11:20:57 +01:00
commit a68fb968ca

View file

@ -1,8 +1,24 @@
--- ---
# execute this role # update proxmox - first node
- name: "manage proxmox" - name: "update proxmox - first node"
hosts: "all" hosts: "{{ groups['proxmox'] | first }}"
become: true
tasks:
# update cluster
- name: "update cluster"
tags: "update-cluster"
block:
# enter ceph maintenance mode
- name: "set ceph enter maintenance mode"
ansible.builtin.import_tasks: "tasks/ceph/enter-maint.yaml"
# update proxmox - all nodes
- name: "update proxmox - all nodes"
hosts: "proxmox"
become: true become: true
serial: 1 serial: 1
tasks: tasks:
@ -12,22 +28,22 @@
tags: "update-cluster" tags: "update-cluster"
block: block:
# collect proxmox cluster nodes
- name: "collect proxmox cluster nodes"
set_fact:
first_node: "{{ groups['proxmox'] | default([]) | first | default('') }}"
last_node: "{{ groups['proxmox'] | default([]) | last | default('') }}"
# enter ceph maintenance mode
- name: "set ceph enter maintenance mode"
ansible.builtin.import_tasks: "tasks/ceph/enter-maint.yaml"
when: "inventory_hostname == first_node"
# update proxmox cluster # update proxmox cluster
- name: "update proxmox cluster nodes" - name: "update proxmox cluster nodes"
ansible.builtin.import_tasks: "tasks/proxmox/update-node.yaml" ansible.builtin.import_tasks: "tasks/proxmox/update-node.yaml"
# update proxmox - last node
- name: "update proxmox - last node"
hosts: "{{ groups['proxmox'] | last }}"
become: true
tasks:
# update cluster
- name: "update cluster"
tags: "update-cluster"
block:
# exit ceph maintenance mode # exit ceph maintenance mode
- name: "exit ceph maintenance mode" - name: "exit ceph maintenance mode"
ansible.builtin.import_tasks: "tasks/ceph/exit-maint.yaml" ansible.builtin.import_tasks: "tasks/ceph/exit-maint.yaml"
when: "inventory_hostname == last_node"