diff --git a/group_vars/all/cinder.yml b/group_vars/all/cinder.yml index 313627283e..fa1b0fed10 100644 --- a/group_vars/all/cinder.yml +++ b/group_vars/all/cinder.yml @@ -17,19 +17,6 @@ cinder_service_region: "{{ service_region }}" cinder_service_port: 8776 # If there are Swift hosts in the environment, then enable cinder backups to it cinder_service_backup_program_enabled: "{{ groups['swift_all'] is defined and groups['swift_all'] | length > 0 }}" -# cinder_backend_rbd_inuse: True if current host has an rbd backend -cinder_backend_rbd_inuse: '{{ (cinder_backends|default("")|to_json).find("cinder.volume.drivers.rbd.RBDDriver") != -1 }}' -# cinder_backends_rbd_inuse: true if at least 1 cinder_backend on any -# cinder_volume host uses Ceph RBD -# http://stackoverflow.com/questions/9486393/jinja2-change-the-value-of-a-variable-inside-a-loop -cinder_backends_rbd_inuse: >- - {% set _var = False -%} - {% for host in groups['cinder_volume'] -%} - {% if hostvars[host]['cinder_backend_rbd_inuse'] | bool -%} - {% set _var = True -%} - {% endif -%} - {% endfor -%} - {{ _var }} cinder_ceph_client: cinder # These are here rather than in cinder_all because diff --git a/group_vars/cinder_volume.yml b/group_vars/cinder_volume.yml index 1533d7d9b4..15feb21e0c 100644 --- a/group_vars/cinder_volume.yml +++ b/group_vars/cinder_volume.yml @@ -13,5 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# cinder_backend_rbd_inuse: True if current host has an rbd backend +# this is defined identically downstream in the os_cinder role, but redefined +# here so it can be consumed by the nova group vars +cinder_backend_rbd_inuse: '{{ (cinder_backends|default("")|to_json).find("cinder.volume.drivers.rbd.RBDDriver") != -1 }}' + lxc_container_config_list: - "lxc.aa_profile=unconfined" diff --git a/playbooks/common-playbooks/cinder.yml b/playbooks/common-playbooks/cinder.yml index 8adb16b381..bf5f9ea8da 100644 --- a/playbooks/common-playbooks/cinder.yml +++ b/playbooks/common-playbooks/cinder.yml @@ -97,15 +97,6 @@ - role: "os_cinder" cinder_storage_address: "{{ storage_address }}" - - role: "ceph_client" - openstack_service_system_user: "{{ cinder_system_user_name }}" - openstack_service_venv_bin: "{{ cinder_bin }}" - when: - - "'cinder_volume' in group_names" - - "cinder_backend_rbd_inuse | default(false) | bool" - tags: - - ceph - - role: "rsyslog_client" rsyslog_client_log_rotate_file: cinder_log_rotate rsyslog_client_log_dir: "/var/log/cinder" diff --git a/playbooks/common-playbooks/glance.yml b/playbooks/common-playbooks/glance.yml index 9d6696de6c..4fba5b7444 100644 --- a/playbooks/common-playbooks/glance.yml +++ b/playbooks/common-playbooks/glance.yml @@ -61,15 +61,6 @@ roles: - role: "os_glance" - - role: "ceph_client" - openstack_service_system_user: "{{ glance_system_user_name }}" - openstack_service_venv_bin: "{{ glance_bin }}" - when: - - "'glance_api' in group_names" - - "{{ 'rbd' in [glance_default_store | default('none')] + glance_additional_stores | default([]) }}" - tags: - - ceph - - role: "openstack_openrc" tags: - openrc diff --git a/playbooks/common-playbooks/nova.yml b/playbooks/common-playbooks/nova.yml index add3621ec9..10a401e928 100644 --- a/playbooks/common-playbooks/nova.yml +++ b/playbooks/common-playbooks/nova.yml @@ -24,6 +24,24 @@ tags: - nova pre_tasks: + # Enable execution of ceph_client on the nova compute hosts if cinder RBD + # backends are used. This is necessary to ensure that volume-backed Nova + # instances can function when RBD is the volume backend. + - name: Set cinder RBD inuse fact + set_fact: + nova_cinder_rbd_inuse: |- + {% set _var = False %} + {% for host in groups['cinder_volume'] %} + {% if hostvars[host]['cinder_backend_rbd_inuse'] | bool %} + {% set _var = True %} + {% endif %} + {% endfor %} + {{ _var }} + delegate_to: localhost + delegate_facts: True + run_once: yes + tags: + - always # In order to ensure that any container, software or # config file changes which causes a container/service @@ -122,16 +140,7 @@ nova_spicehtml5_git_repo: "{{ openstack_repo_git_url }}/spice-html5" nova_spicehtml5_git_install_branch: "{{ spicehtml5_git_install_branch }}" nova_management_address: "{{ management_address }}" - - - role: "ceph_client" - openstack_service_system_user: "{{ nova_system_user_name }}" - openstack_service_venv_bin: "{{ nova_bin }}" - when: - - "'nova_compute' in group_names" - - "(nova_libvirt_images_rbd_pool is defined) or - (cinder_backends_rbd_inuse | default(false)) | bool" - tags: - - ceph + nova_cinder_rbd_inuse: "{{ hostvars['localhost']['nova_cinder_rbd_inuse'] }}" - role: "openstack_openrc" tags: