diff --git a/tasks/main.yml b/tasks/main.yml index d763c32..546dd38 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -83,7 +83,7 @@ - common-db - manila-config -- include_tasks: mq_setup.yml +- import_tasks: mq_setup.yml when: - "manila_services['manila-api']['group'] in group_names" - "inventory_hostname == ((groups[manila_services['manila-api']['group']]| intersect(ansible_play_hosts)) | list)[0]" @@ -110,22 +110,11 @@ tags: - manila-install -- name: refresh local facts - setup: - filter: ansible_local - gather_subset: "!all" - tags: - - manila-config - -- import_tasks: manila_cleanup_old_facts.yml - tags: - - manila-config - - import_tasks: manila_post_install.yml tags: - manila-config -- include_tasks: manila_db_sync.yml +- import_tasks: manila_db_sync.yml when: - groups['manila_api'] | length > 0 - manila_services['manila-api']['group'] in group_names @@ -138,7 +127,7 @@ - manila-config - name: import_tasks ceph_client role - include_role: + import_role: name: ceph_client vars: openstack_service_system_user: "{{ manila_system_user_name }}" @@ -149,14 +138,6 @@ tags: - ceph -- include_tasks: manila_backend_cephfs.yml - when: - - (manila_enabled_share_protocols | join('\n')) | regex_search('^ceph.*', multiline=True, ignorecase=True) - - manila_services['manila-share']['group'] in group_names - with_dict: "{{ _manila_backends | default({}) }}" - tags: - - manila-config - - import_tasks: service_setup.yml vars: _service_adminuri_insecure: "{{ keystone_service_adminuri_insecure }}" @@ -187,10 +168,25 @@ - name: Flush handlers meta: flush_handlers -- include_tasks: manila_backends.yml +- name: Create singular manila_backends variable for all hosts + set_fact: + _manila_backends: "{{ (_manila_backends | default(manila_backends | default({}))) | combine(hostvars[item]['manila_backends'] | default({})) }}" + with_items: "{{ groups[manila_services['manila-share']['group']] }}" + tags: + - manila-config + +- import_tasks: manila_backends.yml when: - groups[manila_services['manila-share']['group']] | length > 0 - manila_services['manila-api']['group'] in group_names - inventory_hostname == ((groups[manila_services['manila-api']['group']] | intersect(ansible_play_hosts)) | list)[-1] tags: - manila-config + +- import_tasks: manila_backend_cephfs.yml + when: + - manila_backend_rbd_inuse + - manila_services['manila-share']['group'] in group_names + - inventory_hostname == ((groups[manila_services['manila-share']['group']] | intersect(ansible_play_hosts)) | list)[-1] + tags: + - manila-config diff --git a/tasks/manila_backend_cephfs.yml b/tasks/manila_backend_cephfs.yml index 335e544..8101824 100644 --- a/tasks/manila_backend_cephfs.yml +++ b/tasks/manila_backend_cephfs.yml @@ -13,33 +13,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Set _cephfs_mount_dir fact - set_fact: - _cephfs_mount_dir: /mnt/cephfs-ansible-mount - _cephfs_auth_id: "{{ item.value.cephfs_auth_id|default('manila') }}" - - name: Create temporary mount dir - file: - name: "{{ _cephfs_mount_dir }}" + tempfile: state: directory + suffix: manila_cephfs + register: _cephfs_mount_dir - name: Mount CephFS command: | - ceph-fuse --id "{{ _cephfs_auth_id }}" "{{ _cephfs_mount_dir }}" + ceph-fuse --id "{{ item.value.cephfs_auth_id|default('manila') }}" "{{ _cephfs_mount_dir.path }}" changed_when: false - name: Ensure CephFS volumes dir permissions file: - name: "{{ _cephfs_mount_dir }}/volumes" + name: "{{ _cephfs_mount_dir.path }}/volumes" state: directory owner: "{{ manila_system_user_name }}" - name: Unmount CephFS mount: - path: "{{ _cephfs_mount_dir }}" + path: "{{ _cephfs_mount_dir.path }}" state: unmounted - name: Remove temporary mount dir file: - name: "{{ _cephfs_mount_dir }}" + name: "{{ _cephfs_mount_dir.path }}" state: absent diff --git a/tasks/manila_backends.yml b/tasks/manila_backends.yml index 72b8a82..a114faa 100644 --- a/tasks/manila_backends.yml +++ b/tasks/manila_backends.yml @@ -31,11 +31,6 @@ include_role: name: "openstack_openrc" -- name: Create singular manila_backends variable for all hosts - set_fact: - _manila_backends: "{{ (_manila_backends | default(manila_backends | default({}))) | combine(hostvars[item]['manila_backends'] | default({})) }}" - with_items: "{{ groups[manila_services['manila-share']['group']] }}" - - name: Add in manila devices types shell: | . {{ ansible_env.HOME }}/openrc diff --git a/tasks/manila_cleanup_old_facts.yml b/tasks/manila_cleanup_old_facts.yml deleted file mode 100644 index a10241b..0000000 --- a/tasks/manila_cleanup_old_facts.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Copyright 2019, Rackspace US, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# TODO(odyssey4me): -# This file and the task calling it may be removed in Queens. - -- name: Remove the old db_sync fact - ini_file: - dest: "/etc/ansible/facts.d/openstack_ansible.fact" - section: manila - option: "need_db_sync" - state: absent - -- name: refresh local facts - setup: - filter: ansible_local - gather_subset: "!all" diff --git a/vars/debian.yml b/vars/debian.yml index c055814..86baa27 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -65,6 +65,9 @@ manila_lvm_share_distro_packages: - thin-provisioning-tools - nfs-kernel-server +manila_rbd_share_distro_packages: + - ceph-fuse + manila_oslomsg_amqp1_distro_packages: - libsasl2-modules - sasl2-bin diff --git a/vars/distro_install.yml b/vars/distro_install.yml index 87c044d..c686c15 100644 --- a/vars/distro_install.yml +++ b/vars/distro_install.yml @@ -25,6 +25,9 @@ manila_package_list: |- {% if manila_backend_lvm_inuse | bool %} {% set _ = packages.extend(manila_lvm_share_distro_packages) %} {% endif %} + {% if manila_backend_rbd_inuse | bool %} + {% set _ = packages.extend(manila_rbd_share_distro_packages) %} + {% endif %} {% endif %} {% if manila_services['manila-api']['group'] in group_names %} {% set _ = packages.extend(manila_api_distro_packages) %} diff --git a/vars/redhat.yml b/vars/redhat.yml index 59c9b00..504f086 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -50,6 +50,9 @@ manila_lvm_share_distro_packages: - lvm2 - parted +manila_rbd_share_distro_packages: + - ceph-fuse + manila_oslomsg_amqp1_distro_packages: - cyrus-sasl-lib - cyrus-sasl-plain diff --git a/vars/source_install.yml b/vars/source_install.yml index c45f941..e38e7d3 100644 --- a/vars/source_install.yml +++ b/vars/source_install.yml @@ -25,6 +25,9 @@ manila_package_list: |- {% if manila_backend_lvm_inuse | bool %} {% set _ = packages.extend(manila_lvm_share_distro_packages) %} {% endif %} + {% if manila_backend_rbd_inuse | bool %} + {% set _ = packages.extend(manila_rbd_share_distro_packages) %} + {% endif %} {% endif %} {% if manila_oslomsg_amqp1_enabled | bool %} {% set _ = packages.extend(manila_oslomsg_amqp1_distro_packages) %} diff --git a/vars/suse.yml b/vars/suse.yml index b262cdc..56b89a6 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -50,6 +50,9 @@ manila_lvm_share_distro_packages: - lvm2 - parted +manila_rbd_share_distro_packages: + - ceph-fuse + manila_oslomsg_amqp1_distro_packages: - cyrus-sasl - cyrus-sasl-plain