42dd7784de
Commit 2f6b1c6890
changed the way the
cephfs source path was generated and dropped the source path component,
keeping only the list of IPs and ports. This results in failures to
mount cephfs with the following message:
source mount path was not specified
failed to resolve source
Change-Id: I94d18ec064971870264ae8d0b279564f2172e548
Closes-Bug: #1819502
74 lines
2.3 KiB
YAML
74 lines
2.3 KiB
YAML
---
|
|
- name: Check /tmp/cephfs path
|
|
command: "docker exec -u 0 manila_share ls /tmp/cephfs/"
|
|
register: check_cephfs
|
|
changed_when: False
|
|
failed_when: check_cephfs.rc != 0 and check_cephfs.stderr.find('No such file or directory') == -1
|
|
run_once: True
|
|
|
|
- name: Create /tmp/cephfs path
|
|
command: "docker exec -u 0 manila_share mkdir -p /tmp/cephfs"
|
|
run_once: True
|
|
when: check_cephfs.rc != 0
|
|
|
|
- name: Get monitor dump
|
|
command: docker exec manila_share ceph mon dump -c /etc/ceph/ceph.conf --name client.manila -f json
|
|
register: ceph_monitor_dump
|
|
changed_when: False
|
|
run_once: True
|
|
|
|
- name: Get cephfs addr
|
|
vars:
|
|
query: mons[*].public_addr
|
|
# take only ip and port from public_addr, e.g from public_addr: 10.66.1.5:6789/0
|
|
# use 10.66.1.5:6789
|
|
regex: "[^/]*"
|
|
set_fact:
|
|
cephfs_addr: "{{ ceph_monitor_dump.stdout | from_json | json_query(query) | map('regex_search', regex) | join(',') }}:/"
|
|
run_once: true
|
|
|
|
- name: Get cephfs secret
|
|
command: docker exec manila_share ceph-authtool -p /etc/ceph/ceph.client.manila.keyring -n client.manila
|
|
register: manila_keyring
|
|
changed_when: False
|
|
run_once: True
|
|
|
|
- name: Umount cephfs
|
|
command: "docker exec -u 0 manila_share umount /tmp/cephfs/"
|
|
register: umount_cephfs
|
|
changed_when: False
|
|
failed_when: False
|
|
run_once: True
|
|
|
|
- name: Mount cephfs
|
|
command: "docker exec -u 0 manila_share mount -t ceph {{cephfs_addr}} /tmp/cephfs -o name=manila,secret={{ manila_keyring.stdout }}"
|
|
register: mount_cephfs
|
|
changed_when: False
|
|
run_once: True
|
|
|
|
- name: Check volumes path
|
|
command: "docker exec -u 0 manila_share ls /tmp/cephfs/volumes"
|
|
register: check_volume
|
|
changed_when: False
|
|
failed_when: False
|
|
run_once: True
|
|
|
|
- name: Create /tmp/cephfs/volumes path
|
|
command: "docker exec -u 0 manila_share mkdir /tmp/cephfs/volumes"
|
|
register: create_volume
|
|
run_once: True
|
|
when: check_volume.rc != 0
|
|
|
|
- name: Change the owner and group of /tmp/cephfs/volumes
|
|
command: "docker exec -u 0 manila_share chown manila:manila /tmp/cephfs/volumes"
|
|
register: chown_volume
|
|
run_once: True
|
|
when: check_volume.rc != 0 and create_volume.rc == 0
|
|
|
|
- name: Umount cephfs
|
|
command: "docker exec -u 0 manila_share umount /tmp/cephfs"
|
|
changed_when: False
|
|
register: umount_cephfs
|
|
run_once: True
|
|
when: mount_cephfs.rc == 0
|