kolla-ansible/ansible/roles/cinder/tasks/external_ceph.yml
Michal Arbet fdf2385f14 Add support for multiple ceph files
This patch is adding a feature for an option to copy different
ceph configuration files and corresponding keyrings for cinder,
glance, manila, gnocchi and nova services.

This is especially useful when the deployment uses availability
zones as below example.

  - Individual compute can read/write to individual ceph
    cluster in same AZ.
  - Cinder can write to several ceph clusters in several AZs.
  - Glance can use multistore and upload images to
    several ceph clusters in several AZs at once.

Change-Id: Ie4d8ab5a3df748137835cae1c943b9180cd10eb1
2023-06-14 10:18:11 +02:00

88 lines
2.7 KiB
YAML

---
- name: Ensuring cinder service ceph config subdirs exists
vars:
service: "{{ cinder_services[item] }}"
file:
path: "{{ node_config_directory }}/{{ item }}/ceph"
state: "directory"
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
mode: "0770"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_items:
- "cinder-volume"
- "cinder-backup"
- name: Copying over multiple ceph.conf for cinder services
vars:
services_need_config:
- "cinder-volume"
- "cinder-backup"
service_name: "{{ item.0.key }}"
service: "{{ item.0.value }}"
cluster: "{{ item.1.cluster }}"
merge_configs:
sources:
- "{{ node_custom_config }}/cinder/{{ cluster }}.conf"
- "{{ node_custom_config }}/cinder/{{ service_name }}/{{ cluster }}.conf"
dest: "{{ node_config_directory }}/{{ service_name }}/ceph/{{ cluster }}.conf"
mode: "0660"
become: true
when:
- service.enabled | bool
- inventory_hostname in groups[service.group]
- service_name in services_need_config
with_nested:
- "{{ cinder_services | dict2items }}"
- "{{ cinder_ceph_backends }}"
notify:
- "Restart {{ service_name }} container"
- name: Copy over Ceph keyring files for cinder-volume
vars:
keyring: "{{ item.cluster }}.{{ ceph_cinder_keyring }}"
template:
src: "{{ node_custom_config }}/cinder/cinder-volume/{{ keyring }}"
dest: "{{ node_config_directory }}/cinder-volume/ceph/{{ keyring }}"
mode: "0660"
become: true
with_items: "{{ cinder_ceph_backends }}"
when:
- external_ceph_cephx_enabled | bool
- inventory_hostname in groups['cinder-volume']
- cinder_services['cinder-volume'].enabled | bool
notify:
- Restart cinder-volume container
- name: Copy over Ceph keyring files for cinder-backup
template:
src: "{{ node_custom_config }}/cinder/cinder-backup/{{ item }}"
dest: "{{ node_config_directory }}/cinder-backup/ceph/{{ item }}"
mode: "0660"
become: true
register: cinder_backup_ceph_keyring
with_items:
- "{{ cinder_backup_ceph_backend.cluster }}.{{ ceph_cinder_keyring }}"
- "{{ cinder_backup_ceph_backend.cluster }}.{{ ceph_cinder_backup_keyring }}"
when:
- external_ceph_cephx_enabled | bool
- inventory_hostname in groups['cinder-backup']
- cinder_services['cinder-backup'].enabled | bool
notify:
- Restart cinder-backup container
- name: Ensuring config directory has correct owner and permission
become: true
file:
path: "{{ node_config_directory }}/{{ item }}"
recurse: yes
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
when: inventory_hostname in groups[item]
with_items:
- "cinder-volume"
- "cinder-backup"