openstack-ansible-os_manila/tasks/manila_backend_cephfs.yml

46 lines
1.3 KiB
YAML

---
# 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.
- 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 }}"
state: directory
- name: Mount CephFS
command: |
ceph-fuse --id "{{ _cephfs_auth_id }}" "{{ _cephfs_mount_dir }}"
changed_when: false
- name: Ensure CephFS volumes dir permissions
file:
name: "{{ _cephfs_mount_dir }}/volumes"
state: directory
owner: "{{ manila_system_user_name }}"
- name: Unmount CephFS
mount:
path: "{{ _cephfs_mount_dir }}"
state: unmounted
- name: Remove temporary mount dir
file:
name: "{{ _cephfs_mount_dir }}"
state: absent