diff --git a/playbooks/update.yml b/playbooks/update.yml index 2d518f2883..5a35158e04 100644 --- a/playbooks/update.yml +++ b/playbooks/update.yml @@ -49,6 +49,42 @@ dest: "/etc/yum.repos.d/" src: "{{ cifmw_basedir }}/artifacts/repositories/" +- name: Run Ceph update if part of the deployment + hosts: "{{ (groups[cifmw_ceph_target | default('computes')] | default([]))[:1] }}" + gather_facts: true + tasks: + - name: Update Ceph + when: cifmw_ceph_update | default(false) | bool + tags: + - update + - ceph_update + block: + - name: Get ceph.conf to inspect + become: true + ansible.builtin.slurp: + src: "{{ cifmw_ceph_conf }}" + vars: + cifmw_ceph_conf: "/etc/ceph/ceph.conf" + register: cephconf + + - name: Save /ceph.conf and inspect content + become: true + delegate_to: localhost + ansible.builtin.copy: + content: "{{ cephconf['content'] | b64decode }}" + dest: "/tmp/ceph.conf" + + - name: Extract the CephFSID from ceph.conf + ansible.builtin.set_fact: + ceph_fsid: "{{ lookup('ansible.builtin.ini', 'fsid', section='global', file='/tmp/ceph.conf') }}" + + - name: Perform a Ceph Update + ansible.builtin.import_role: + name: cifmw_cephadm + tasks_from: ceph_upgrade + vars: + cifmw_cephadm_fsid: "{{ ceph_fsid }}" + - name: Run update role hosts: "{{ cifmw_target_host | default('localhost') }}" gather_facts: false diff --git a/roles/cifmw_ceph_spec/defaults/main.yml b/roles/cifmw_ceph_spec/defaults/main.yml index cc78fed4ca..bd35556357 100644 --- a/roles/cifmw_ceph_spec/defaults/main.yml +++ b/roles/cifmw_ceph_spec/defaults/main.yml @@ -39,3 +39,6 @@ cifmw_ceph_spec_private_network: '' # Enable over-the-wire and on-disk encryption cifmw_ceph_spec_encryption: false + +# osd pool default size is 1 because of single node HCI jobs +cifmw_cephadm_single_host_defaults: true diff --git a/roles/cifmw_ceph_spec/templates/initial_ceph.conf.j2 b/roles/cifmw_ceph_spec/templates/initial_ceph.conf.j2 index 3062ccbbff..15f55ab522 100644 --- a/roles/cifmw_ceph_spec/templates/initial_ceph.conf.j2 +++ b/roles/cifmw_ceph_spec/templates/initial_ceph.conf.j2 @@ -7,7 +7,9 @@ ms_mon_client_mode = secure ms_mon_cluster_mode = secure ms_mon_service_mode = secure {% endif %} +{% if cifmw_cephadm_single_host_defaults %} osd pool default size = 1 +{% endif %} {% if cifmw_ceph_spec_public_network %} public_network = {{ cifmw_ceph_spec_public_network }} {% endif %} diff --git a/roles/cifmw_cephadm/tasks/ceph_upgrade.yml b/roles/cifmw_cephadm/tasks/ceph_upgrade.yml index d1918fea23..31b8f33872 100644 --- a/roles/cifmw_cephadm/tasks/ceph_upgrade.yml +++ b/roles/cifmw_cephadm/tasks/ceph_upgrade.yml @@ -20,10 +20,10 @@ - name: Fail if health is HEALTH_WARN || HEALTH_ERR ansible.builtin.fail: - msg: Ceph is in {{ ceph_health.status }} state. + msg: Ceph is in {{ ceph_health.health.status }} state. when: - - ceph_health.status == 'HEALTH_WARN' or - ceph_health.status == 'HEALTH_ERR' + - ceph_health.health.status == 'HEALTH_WARN' or + ceph_health.health.status == 'HEALTH_ERR' - name: Build container image target ansible.builtin.set_fact: