Skip to content
Snippets Groups Projects
Commit a715a9fb authored by Zuul's avatar Zuul Committed by Gerrit Code Review
Browse files

Merge "Add task to create volumes path in cephfs"

parents 1bdb98e9 6bfc6d4f
No related branches found
No related tags found
No related merge requests found
......@@ -27,3 +27,10 @@
- name: Flush handlers
meta: flush_handlers
- include: fix_cephfs_owner.yml
when:
- enable_ceph | bool
- enable_ceph_mds | bool
- enable_manila_backend_cephfs_native | bool
- inventory_hostname in groups['manila-share']
---
- 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 cephfs addr
set_fact: cephfs_addr={% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}{% if loop.last %}:6789:/{% else %},{% endif %}{% endfor %}
run_once: True
- name: Pulling cephx keyring for manila
command: docker exec ceph_mon ceph auth get-key client.manila
register: manila_keyring
delegate_to: "{{ groups['ceph-mon'][0] }}"
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment