From 120d6be99290259c560efcd46a8c1eefb4a55a2b Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Thu, 13 Jun 2024 18:20:06 +0100 Subject: [PATCH] Switch to ceph-ansible stable-8.0 This patch includes the openstack specific pool configuration that previously was in ceph-ansible, and also adds a playbook to configure ceph pools and distribute the keys to all monitor hosts. Co-Authored-By: Damian Dabrowski Change-Id: Ic55daf6ba7fdb47525ee1913f70e87296383866d --- .../ceph-ansible-8-3923428844537c1b.yaml | 19 ++++++ ansible-role-requirements.yml | 4 +- inventory/group_vars/ceph-rgw.yml | 3 +- inventory/group_vars/ceph_all.yml | 30 +++++++++ playbooks/ceph-install.yml | 6 +- playbooks/ceph-pools.yml | 61 +++++++++++++++++++ playbooks/setup-infrastructure.yml | 3 + .../templates/user_variables_ceph.yml.j2 | 2 +- 8 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/ceph-ansible-8-3923428844537c1b.yaml create mode 100644 playbooks/ceph-pools.yml diff --git a/ releasenotes/notes/ceph-ansible-8-3923428844537c1b.yaml b/ releasenotes/notes/ceph-ansible-8-3923428844537c1b.yaml new file mode 100644 index 0000000000..74f15abbc3 --- /dev/null +++ b/ releasenotes/notes/ceph-ansible-8-3923428844537c1b.yaml @@ -0,0 +1,19 @@ +--- +features: + - | + The external dependancy ceph-ansible is upgraded to version 8.0 and + brings in significant changes within the ceph-ansible project. Deployers + using OpenStack-Ansible are reminded that the ceph-ansible integration + with OSA is primarily a test fixture and production deployments should + ideally deploy an independant ceph cluster. The upgrade between releases + of ceph-ansible is not tested by the OpenStack-Ansible project. +upgrade: + - | + The external dependancy ceph-ansible is upgraded to version 8.0 and + brings in significant changes within the ceph-ansible project. + Any deployments with important data held in a ceph cluster deployed + using the OpenStack-Ansible integration with ceph-ansible should + independantly verify that upstream changes in ceph-ansible result + in a successful upgrade. This could undertaken in a test or staging + environment. The upgrade between releases of ceph-ansible is not + tested by the OpenStack-Ansible project. \ No newline at end of file diff --git a/ansible-role-requirements.yml b/ansible-role-requirements.yml index 727de97afe..218d537bed 100644 --- a/ansible-role-requirements.yml +++ b/ansible-role-requirements.yml @@ -333,6 +333,6 @@ - name: ceph-ansible scm: git src: https://github.com/ceph/ceph-ansible - version: stable-7.0 - trackbranch: stable-7.0 + version: stable-8.0 + trackbranch: stable-8.0 shallow_since: '2024-05-15' diff --git a/inventory/group_vars/ceph-rgw.yml b/inventory/group_vars/ceph-rgw.yml index db3655b538..fa73d87224 100644 --- a/inventory/group_vars/ceph-rgw.yml +++ b/inventory/group_vars/ceph-rgw.yml @@ -1,8 +1,9 @@ --- +ceph_rgw_client_name: "client.rgw.{{ rgw_zone | default('default') }}.{{ hostvars[inventory_hostname]['ansible_facts']['hostname']}}.rgw0" ceph_conf_overrides_rgw: |- {{ { - 'client.rgw.' ~ hostvars[inventory_hostname]['ansible_facts']['hostname'] ~ '.rgw0': { + ceph_rgw_client_name: { 'rgw_keystone_url': keystone_service_adminuri, 'rgw_keystone_api_version': 3, 'rgw_keystone_admin_user': radosgw_admin_user, diff --git a/inventory/group_vars/ceph_all.yml b/inventory/group_vars/ceph_all.yml index 8773406245..94374f3eaf 100644 --- a/inventory/group_vars/ceph_all.yml +++ b/inventory/group_vars/ceph_all.yml @@ -47,3 +47,33 @@ libntirpc_stable_deb_repo: http://ppa.launchpad.net/nfs-ganesha/libntirpc-5/ubun ntp_service_enabled: False dashboard_enabled: True + +openstack_glance_pool: + name: "images" + application: "rbd" +openstack_cinder_pool: + name: "volumes" + application: "rbd" +openstack_nova_pool: + name: "vms" + application: "rbd" +openstack_cinder_backup_pool: + name: "backups" + application: "rbd" +openstack_gnocchi_pool: + name: "metrics" + application: "rbd" +openstack_cephfs_data_pool: + name: "manila_data" + application: "cephfs" +openstack_cephfs_metadata_pool: + name: "manila_metadata" + application: "cephfs" +openstack_pools: + - "{{ openstack_glance_pool }}" + - "{{ openstack_cinder_pool }}" + - "{{ openstack_nova_pool }}" + - "{{ openstack_cinder_backup_pool }}" + - "{{ openstack_gnocchi_pool }}" + - "{{ openstack_cephfs_data_pool }}" + - "{{ openstack_cephfs_metadata_pool }}" diff --git a/playbooks/ceph-install.yml b/playbooks/ceph-install.yml index 5f1b7b6d9a..0a4033284c 100644 --- a/playbooks/ceph-install.yml +++ b/playbooks/ceph-install.yml @@ -15,7 +15,11 @@ - name: Gather ceph-mon facts hosts: ceph-mon - gather_facts: "{{ osa_gather_facts | default(True) }}" + gather_facts: false + tasks: + - name: Refresh all_addresses facts + setup: + gather_subset: "all_ipv4_addresses,all_ipv6_addresses" tags: - always diff --git a/playbooks/ceph-pools.yml b/playbooks/ceph-pools.yml new file mode 100644 index 0000000000..e560479d72 --- /dev/null +++ b/playbooks/ceph-pools.yml @@ -0,0 +1,61 @@ +- name: Create ceph pools + hosts: "{{ groups['ceph-mon'][0] | default([]) }}" + user: root + gather_facts: false + vars: + is_metal: "{{ properties.is_metal|default(false) }}" + vars_files: + - "defaults/{{ install_method }}_install.yml" + roles: + - role: ceph-defaults + tags: + - skip_ansible_lint + tasks: + - name: Create openstack pool(s) + ceph_pool: + name: "{{ item.name }}" + cluster: "{{ cluster }}" + pg_num: "{{ item.pg_num | default(omit) }}" + pgp_num: "{{ item.pgp_num | default(omit) }}" + size: "{{ item.size | default(omit) }}" + min_size: "{{ item.min_size | default(omit) }}" + pool_type: "{{ item.type | default('replicated') }}" + rule_name: "{{ item.rule_name | default(omit) }}" + erasure_profile: "{{ item.erasure_profile | default(omit) }}" + pg_autoscale_mode: "{{ item.pg_autoscale_mode | default(omit) }}" + target_size_ratio: "{{ item.target_size_ratio | default(omit) }}" + application: "{{ item.application | default(omit) }}" + with_items: "{{ openstack_pools }}" + + - name: Generate keys + ceph_key: + name: "{{ item.name }}" + caps: "{{ item.caps }}" + secret: "{{ item.key | default('') }}" + cluster: "{{ cluster }}" + mode: "{{ item.mode | default(ceph_keyring_permissions) }}" + with_items: "{{ openstack_keys }}" + no_log: "{{ no_log_on_ceph_key_tasks }}" + + - name: Get keys from monitors + ceph_key: + name: "{{ item.name }}" + cluster: "{{ cluster }}" + output_format: plain + state: info + register: _osp_keys + with_items: "{{ openstack_keys }}" + no_log: "{{ no_log_on_ceph_key_tasks }}" + + - name: Distribute ceph keys to all mons + ansible.builtin.copy: + dest: "/etc/ceph/{{ cluster }}.{{ item.0.item.name }}.keyring" + content: "{{ item.0.stdout + '\n' }}" + owner: 'ceph' + group: 'ceph' + mode: "{{ item.0.item.mode | default(ceph_keyring_permissions) }}" + with_nested: + - "{{ _osp_keys.results }}" + - "{{ groups['ceph-mon'] }}" + delegate_to: "{{ item.1 }}" + no_log: "{{ no_log_on_ceph_key_tasks }}" diff --git a/playbooks/setup-infrastructure.yml b/playbooks/setup-infrastructure.yml index e1bddff40b..96809fda65 100644 --- a/playbooks/setup-infrastructure.yml +++ b/playbooks/setup-infrastructure.yml @@ -46,6 +46,9 @@ - name: Importing ceph-install playbook import_playbook: ceph-install.yml +- name: Importing ceph-pools playbook + import_playbook: ceph-pools.yml + - name: Importing ceph-nfs-install playbook import_playbook: ceph-nfs-install.yml diff --git a/tests/roles/bootstrap-host/templates/user_variables_ceph.yml.j2 b/tests/roles/bootstrap-host/templates/user_variables_ceph.yml.j2 index 3c4d9a1cb7..2b7dae4847 100644 --- a/tests/roles/bootstrap-host/templates/user_variables_ceph.yml.j2 +++ b/tests/roles/bootstrap-host/templates/user_variables_ceph.yml.j2 @@ -15,7 +15,6 @@ ## ceph-ansible AIO settings is_hci: true -common_single_host_mode: true monitor_interface: "{{ ('metal' in bootstrap_host_scenarios_expanded) | ternary('br-storage', 'eth2') }}" # Storage network in the AIO public_network: "{{ (storage_range ~ '.0/' ~ netmask) | ansible.utils.ipaddr('net') }}" journal_size: 100 @@ -23,6 +22,7 @@ osd_scenario: collocated ceph_conf_overrides_custom: global: mon_max_pg_per_osd: 500 + osd_crush_chooseleaf_type: 0 openstack_config: true # Ceph ansible automatically creates pools & keys cinder_default_volume_type: aio_ceph glance_ceph_client: glance