feat: removed sudo and added playbook file

This commit is contained in:
Simon Cornet 2025-11-16 10:55:34 +01:00
commit 4e4f739c7c
6 changed files with 44 additions and 50 deletions

View file

@ -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"

View file

@ -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"

View file

@ -1,26 +0,0 @@
---
# 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"

View file

@ -3,8 +3,7 @@
# enter maintenance mode
- name: "enter maintenance mode"
ansible.builtin.shell:
cmd:
"sudo /usr/sbin/ha-manager crm-command node-maintenance enable {{ inventory_hostname_short }}"
cmd: "/usr/sbin/ha-manager crm-command node-maintenance enable {{ inventory_hostname_short }}"
changed_when: false
failed_when: "maintenance_result.rc != 0"
register: "maintenance_result"
@ -37,7 +36,7 @@
# install firmware updates
- name: "install firmware updates"
ansible.builtin.shell:
cmd: "sudo fwupdmgr upgrade --no-reboot-check --assume-yes"
cmd: "fwupdmgr upgrade --no-reboot-check --assume-yes"
changed_when: false
failed_when: false
@ -53,8 +52,7 @@
# exit maintenance mode
- name: "exit maintenance mode"
ansible.builtin.shell:
cmd:
"sudo /usr/sbin/ha-manager crm-command node-maintenance disable {{ inventory_hostname_short }}"
cmd: "/usr/sbin/ha-manager crm-command node-maintenance disable {{ inventory_hostname_short }}"
changed_when: false
delay: 10
failed_when: "maintenance_exit_result.rc != 0"