Commit 4e4f739c authored by Simon Cornet's avatar Simon Cornet
Browse files

feat: removed sudo and added playbook file

parent 6314add6
Loading
Loading
Loading
Loading
Loading

playbook.yaml

0 → 100644
+33 −0
Original line number Diff line number Diff line
---

# execute this role
- name: "manage proxmox"
  hosts: "all"
  become: true
  serial: 1
  tasks:

    # update cluster
    - name: "update cluster"
      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 cluster
        - name: "update proxmox cluster nodes"
          ansible.builtin.import_tasks: "tasks/proxmox/update-node.yaml"

        # exit ceph maintenance mode
        - name: "exit ceph maintenance mode"
          ansible.builtin.import_tasks: "tasks/ceph/exit-maint.yaml"
          when: "inventory_hostname == last_node"
+2 −2
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@ This role updates a Proxmox Cluster.

| Operating System | Version |
| --- | ----- |
| Debian | 12 |
| Proxmox VE | 9 |

## Tags

This role has no tags.
This role has one tag; `update-cluster`.
+3 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
    # set ceph osd noout settings
    - name: "set ceph noout"
      ansible.builtin.shell:
        cmd: "sudo ceph osd set noout"
        cmd: "ceph osd set noout"
      changed_when: false
      failed_when: "ceph_noout_result.rc != 0"
      register: "ceph_noout_result"
@@ -15,7 +15,7 @@
    # set ceph osd nobackfill settings
    - name: "set ceph nobackfill"
      ansible.builtin.shell:
        cmd: "sudo ceph osd set nobackfill"
        cmd: "ceph osd set nobackfill"
      changed_when: false
      failed_when: "ceph_nobackfill_result.rc != 0"
      register: "ceph_nobackfill_result"
@@ -23,7 +23,7 @@
    # set ceph osd norebalance settings
    - name: "set ceph norebalance"
      ansible.builtin.shell:
        cmd: "sudo ceph osd set norebalance"
        cmd: "ceph osd set norebalance"
      changed_when: false
      failed_when: "ceph_norebalance_result.rc != 0"
      register: "ceph_norebalance_result"
+3 −14
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
    # unset ceph osd noout settings
    - name: "unset ceph noout"
      ansible.builtin.shell:
        cmd: "sudo ceph osd unset noout"
        cmd: "ceph osd unset noout"
      changed_when: false
      failed_when: "ceph_noout_result.rc != 0"
      register: "ceph_noout_result"
@@ -16,7 +16,7 @@
    # unset ceph osd nobackfill settings
    - name: "unset ceph nobackfill"
      ansible.builtin.shell:
        cmd: "sudo ceph osd unset nobackfill"
        cmd: "ceph osd unset nobackfill"
      changed_when: false
      failed_when: "ceph_nobackfill_result.rc != 0"
      register: "ceph_nobackfill_result"
@@ -25,19 +25,8 @@
    # unset ceph osd norebalance settings
    - name: "unset ceph norebalance"
      ansible.builtin.shell:
        cmd: "sudo ceph osd unset norebalance"
        cmd: "ceph osd unset norebalance"
      changed_when: false
      failed_when: "ceph_norebalance_result.rc != 0"
      register: "ceph_norebalance_result"
      tags: "cluster"

    # wait for ceph to be healthy
    - name: "wait for ceph to be healthy"
      ansible.builtin.shell:
        cmd: "sudo ceph -s"
      changed_when: false
      delay: 10
      register: "ceph_status"
      retries: 30
      tags: "cluster"
      until: "'HEALTH_OK' in ceph_status.stdout"

tasks/main.yaml

deleted100644 → 0
+0 −26
Original line number Diff line number Diff line
---

# update cluster
- name: "update cluster"
  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.include_tasks: "ceph/enter-maint.yaml"
      when: "inventory_hostname == first_node"

    # update proxmox cluster
    - name: "update proxmox cluster nodes"
      ansible.builtin.include_tasks: "proxmox/update-node.yaml"

    # exit ceph maintenance mode
    - name: "exit ceph maintenance mode"
      ansible.builtin.include_tasks: "ceph/exit-maint.yaml"
      when: "inventory_hostname == last_node"
Loading