Commit a68fb968 authored by Simon Cornet's avatar Simon Cornet
Browse files

fix: playbook execution order

parent 4e4f739c
Loading
Loading
Loading
Loading
+28 −12
Original line number Diff line number Diff line
---

# execute this role
- name: "manage proxmox"
  hosts: "all"
# update proxmox - first node
- name: "update proxmox - first node"
  hosts: "{{ groups['proxmox'] | first }}"
  become: true
  serial: 1
  tasks:

    # update cluster
@@ -12,22 +11,39 @@
      tags: "update-cluster"
      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 - all nodes
- name: "update proxmox - all nodes"
  hosts: "proxmox"
  become: true
  serial: 1
  tasks:

    # update cluster
    - name: "update cluster"
      tags: "update-cluster"
      block:

        # update proxmox cluster
        - name: "update proxmox cluster nodes"
          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
        - name: "exit ceph maintenance mode"
          ansible.builtin.import_tasks: "tasks/ceph/exit-maint.yaml"
          when: "inventory_hostname == last_node"