diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index aae2c1b4dc..32e0e088c9 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -315,6 +315,7 @@ enable_ceph: "no" enable_ceph_rgw: "no" enable_chrony: "no" enable_cinder: "no" +enable_cinder_backup: "yes" enable_cinder_backend_hnas_iscsi: "no" enable_cinder_backend_hnas_nfs: "no" enable_cinder_backend_iscsi: "no" @@ -490,6 +491,8 @@ gnocchi_backend_storage: "{{ 'ceph' if enable_ceph|bool else 'file' }}" cinder_backend_ceph: "{{ enable_ceph }}" cinder_backend_vmwarevc_vmdk: "no" cinder_volume_group: "cinder-volumes" + +# Valid options are [ nfs, swift, ceph ] cinder_backup_driver: "ceph" cinder_backup_share: "" cinder_backup_mount_options_nfs: "" diff --git a/ansible/roles/cinder/defaults/main.yml b/ansible/roles/cinder/defaults/main.yml index 84fabfc2c5..29170c6327 100644 --- a/ansible/roles/cinder/defaults/main.yml +++ b/ansible/roles/cinder/defaults/main.yml @@ -39,7 +39,7 @@ cinder_services: cinder-backup: container_name: cinder_backup group: cinder-backup - enabled: true + enabled: "{{ enable_cinder_backup | bool }}" image: "{{ cinder_backup_image_full }}" privileged: True volumes: diff --git a/ansible/roles/cinder/tasks/ceph.yml b/ansible/roles/cinder/tasks/ceph.yml index 6cb41aafee..5e2d05daad 100644 --- a/ansible/roles/cinder/tasks/ceph.yml +++ b/ansible/roles/cinder/tasks/ceph.yml @@ -1,26 +1,34 @@ --- - name: Ensuring config directory exists + vars: + services_need_directory: + - "cinder-volume" + - "cinder-backup" file: - path: "{{ node_config_directory }}/{{ item }}" + path: "{{ node_config_directory }}/{{ item.key }}" state: "directory" - with_items: - - "cinder-volume" - - "cinder-backup" - when: inventory_hostname in groups['cinder-volume'] + when: + - item.value.enabled | bool + - inventory_hostname in groups[item.value.group] + - item.key in services_need_directory + with_dict: "{{ cinder_services }}" - name: Copying over ceph.conf(s) vars: - service_name: "{{ item }}" + services_need_config: + - "cinder-volume" + - "cinder-backup" merge_configs: sources: - "{{ role_path }}/../ceph/templates/ceph.conf.j2" - "{{ node_custom_config }}/ceph.conf" - "{{ node_custom_config }}/ceph/{{ inventory_hostname }}/ceph.conf" - dest: "{{ node_config_directory }}/{{ item }}/ceph.conf" - with_items: - - "cinder-volume" - - "cinder-backup" - when: inventory_hostname in groups['cinder-volume'] + dest: "{{ node_config_directory }}/{{ item.key }}/ceph.conf" + when: + - item.value.enabled | bool + - inventory_hostname in groups[item.value.group] + - item.key in services_need_config + with_dict: "{{ cinder_services }}" - include: ../../ceph_pools.yml vars: @@ -59,4 +67,6 @@ - { service_name: "cinder-volume", key_name: "cinder", content: "{{ cephx_key_cinder.stdout }}" } - { service_name: "cinder-backup", key_name: "cinder", content: "{{ cephx_key_cinder.stdout }}" } - { service_name: "cinder-backup", key_name: "cinder-backup", content: "{{ cephx_key_cinder_backup.stdout }}" } - when: inventory_hostname in groups['cinder-volume'] + when: + - inventory_hostname in groups[item.service_name] + - cinder_services[item.service_name].enabled | bool diff --git a/ansible/roles/cinder/tasks/external_ceph.yml b/ansible/roles/cinder/tasks/external_ceph.yml index 4c78d17b96..d36bd2d705 100644 --- a/ansible/roles/cinder/tasks/external_ceph.yml +++ b/ansible/roles/cinder/tasks/external_ceph.yml @@ -1,25 +1,33 @@ --- - name: Ensuring config directory exists + vars: + services_need_directory: + - "cinder-volume" + - "cinder-backup" file: - path: "{{ node_config_directory }}/cinder-{{ item }}" + path: "{{ node_config_directory }}/{{ item.key }}" state: "directory" - when: inventory_hostname in groups['cinder-volume'] or - inventory_hostname in groups['cinder-backup'] - with_items: - - volume - - backup + when: + - item.value.enabled | bool + - inventory_hostname in groups[item.value.group] + - item.key in services_need_directory + with_dict: "{{ cinder_services }}" - name: Copying over ceph.conf for Cinder vars: - service_name: "{{ item }}" + services_need_config: + - "cinder-volume" + - "cinder-backup" merge_configs: sources: - "{{ node_custom_config }}/cinder/ceph.conf" - - "{{ node_custom_config }}/cinder/{{ item }}/ceph.conf" - dest: "{{ node_config_directory }}/{{ item }}/ceph.conf" - with_items: - - "cinder-backup" - - "cinder-volume" + - "{{ node_custom_config }}/cinder/{{ item.key }}/ceph.conf" + dest: "{{ node_config_directory }}/{{ item.key }}/ceph.conf" + when: + - item.value.enabled | bool + - inventory_hostname in groups[item.value.group] + - item.key in services_need_config + with_dict: "{{ cinder_services }}" - name: Copy over Ceph keyring files for cinder-volume copy: @@ -27,7 +35,10 @@ dest: "{{ node_config_directory }}/cinder-volume/" with_fileglob: - "{{ node_custom_config }}/cinder/cinder-volume/ceph.client*" - when: external_ceph_cephx_enabled | bool + when: + - external_ceph_cephx_enabled | bool + - inventory_hostname in groups['cinder-volume'] + - cinder_services['cinder-volume'].enabled | bool - name: Copy over Ceph keyring files for cinder-backup copy: @@ -35,4 +46,7 @@ dest: "{{ node_config_directory }}/cinder-backup/" with_fileglob: - "{{ node_custom_config }}/cinder/cinder-volume/ceph.client*" - when: external_ceph_cephx_enabled | bool + when: + - external_ceph_cephx_enabled | bool + - inventory_hostname in groups['cinder-backup'] + - cinder_services['cinder-backup'].enabled | bool diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2 index 9862eaf618..e08b13b3c4 100644 --- a/ansible/roles/cinder/templates/cinder.conf.j2 +++ b/ansible/roles/cinder/templates/cinder.conf.j2 @@ -21,7 +21,7 @@ os_region_name = {{ openstack_region_name }} enabled_backends = {{ cinder_enabled_backends|map(attribute='name')|join(',') }} {% endif %} -{% if service_name == "cinder-backup" %} +{% if service_name == "cinder-backup" and enable_cinder_backup | bool %} {% if enable_ceph | bool and cinder_backup_driver == "ceph" %} backup_driver = cinder.backup.drivers.ceph backup_ceph_conf = /etc/ceph/ceph.conf diff --git a/ansible/roles/horizon/templates/local_settings.j2 b/ansible/roles/horizon/templates/local_settings.j2 index bc6d995465..024169fee0 100644 --- a/ansible/roles/horizon/templates/local_settings.j2 +++ b/ansible/roles/horizon/templates/local_settings.j2 @@ -287,7 +287,7 @@ OPENSTACK_HYPERVISOR_FEATURES = { # The OPENSTACK_CINDER_FEATURES settings can be used to enable optional # services provided by cinder that is not exposed by its extension API. OPENSTACK_CINDER_FEATURES = { - 'enable_backup': True, + 'enable_backup': {{ 'True' if enable_cinder_backup | bool else 'False' }}, } # The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index 69d7c0be19..22f823824d 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -126,6 +126,7 @@ kolla_internal_vip_address: "10.10.10.254" #enable_ceph_rgw: "no" #enable_chrony: "no" #enable_cinder: "no" +#enable_cinder_backup: "yes" #enable_cinder_backend_hnas_iscsi: "no" #enable_cinder_backend_hnas_nfs: "no" #enable_cinder_backend_iscsi: "no" @@ -278,6 +279,8 @@ kolla_internal_vip_address: "10.10.10.254" #cinder_backend_ceph: "{{ enable_ceph }}" #cinder_backend_vmwarevc_vmdk: "no" #cinder_volume_group: "cinder-volumes" + +# Valid options are [ nfs, swift, ceph ] #cinder_backup_driver: "ceph" #cinder_backup_share: "" #cinder_backup_mount_options_nfs: ""