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.

Note: In addition to the cherry-picked commit, we add jmespath to
requirements as it is required for the json_query filter.

Change-Id: I1e9a40e4ee893a53f04909ef7835be005c9b5276
Closes-Bug: #1778720
(cherry picked from commit 2f6b1c6890)
This commit is contained in:
Will Szumski 2018-06-22 17:19:38 +01:00 committed by Pierre Riteau
parent 8af677e82c
commit 02da5c74f8
4 changed files with 19 additions and 7 deletions

View File

@ -31,6 +31,7 @@ manila_services:
- "/etc/localtime:/etc/localtime:ro"
- "/run/:/run/:shared"
- "kolla_logs:/var/log/kolla/"
- "/lib/modules:/lib/modules:ro"
manila-data:
container_name: "manila_data"
group: "manila-data"

View File

@ -31,7 +31,6 @@
- include: 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']

View File

@ -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

View File

@ -11,3 +11,4 @@ setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.
PyYAML>=3.10 # MIT
netaddr>=0.7.18 # BSD
cryptography!=2.0,>=1.9 # BSD/Apache-2.0
jmespath>=0.9.0 # MIT