From 2f6b1c6890cf7ea6b0dd33ac219646e4dcaf1fd6 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Fri, 22 Jun 2018 17:19:38 +0100 Subject: [PATCH] Create /volumes when using external ceph 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 --- ansible/roles/manila/defaults/main.yml | 1 + ansible/roles/manila/tasks/deploy.yml | 3 +-- .../roles/manila/tasks/fix_cephfs_owner.yml | 21 ++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ansible/roles/manila/defaults/main.yml b/ansible/roles/manila/defaults/main.yml index b77abbc625..be487e2961 100644 --- a/ansible/roles/manila/defaults/main.yml +++ b/ansible/roles/manila/defaults/main.yml @@ -35,6 +35,7 @@ manila_services: - "/etc/localtime:/etc/localtime:ro" - "/run/:/run/:shared" - "kolla_logs:/var/log/kolla/" + - "/lib/modules:/lib/modules:ro" - "{{ kolla_dev_repos_directory ~ '/manila/manila:/var/lib/kolla/venv/lib/python2.7/site-packages/manila' if manila_dev_mode | bool else '' }}" dimensions: "{{ manila_share_dimensions }}" manila-data: diff --git a/ansible/roles/manila/tasks/deploy.yml b/ansible/roles/manila/tasks/deploy.yml index 00060bb0ce..c9cf92720f 100644 --- a/ansible/roles/manila/tasks/deploy.yml +++ b/ansible/roles/manila/tasks/deploy.yml @@ -33,7 +33,6 @@ - include_tasks: fix_cephfs_owner.yml when: - - enable_ceph | bool - - enable_ceph_mds | bool + - not enable_ceph | bool or enable_ceph_mds | bool - enable_manila_backend_cephfs_native | bool - inventory_hostname in groups['manila-share'] diff --git a/ansible/roles/manila/tasks/fix_cephfs_owner.yml b/ansible/roles/manila/tasks/fix_cephfs_owner.yml index 4c58c12bdc..f792b48b95 100644 --- a/ansible/roles/manila/tasks/fix_cephfs_owner.yml +++ b/ansible/roles/manila/tasks/fix_cephfs_owner.yml @@ -11,14 +11,25 @@ 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 %} +- 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: Pulling cephx keyring for manila - command: docker exec ceph_mon ceph auth get-key client.manila +- 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 - delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False run_once: True