2f6b1c6890
Currently we only create the /volumes directory when using the kolla-ansible bundled ceph. This extends the functionality to external ceph. Change-Id: I1e9a40e4ee893a53f04909ef7835be005c9b5276 Closes-Bug: #1778720
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
|