83 lines
3.0 KiB
YAML
83 lines
3.0 KiB
YAML
---
|
|
# Copyright 2021 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
- name: Get ceph_cli
|
|
include_tasks: ceph_cli.yaml
|
|
vars:
|
|
ceph_command: 'rados'
|
|
# ceph cli needs manila cephx keyring if admin is not available
|
|
select_keyring: "{{ 'manila' if groups['ceph_mon'] | default([]) | length == 0 else 'admin' }}"
|
|
# when ceph is external and admin keyring is not available we're passing -n client.{{ selected_keyring }}
|
|
external_cluster: "{{ true if groups['ceph_mon'] | default([]) | length == 0 else false }}"
|
|
|
|
- name: check if rados index object exists
|
|
shell: |
|
|
{{ tripleo_cephadm_ceph_cli }} -p {{ cephfs_data_pool.name }} --cluster {{ tripleo_cephadm_cluster }} \
|
|
ls | grep {{ tripleo_cephadm_nfs_rados_export_index }}
|
|
changed_when: false
|
|
failed_when: false
|
|
register: rados_index_exists
|
|
check_mode: false
|
|
when: tripleo_cephadm_ceph_nfs_rados_backend | bool
|
|
|
|
- name: create an empty rados index object
|
|
command: |
|
|
{{ tripleo_cephadm_ceph_cli }} -p {{ cephfs_data_pool.name }} --cluster {{ tripleo_cephadm_cluster }} \
|
|
put {{ tripleo_cephadm_nfs_rados_export_index }} /dev/null
|
|
when:
|
|
- tripleo_cephadm_ceph_nfs_rados_backend | bool
|
|
- rados_index_exists.rc != 0
|
|
|
|
- name: Extract key
|
|
ceph_key:
|
|
name: "{{ item.name }}"
|
|
output_format: plain
|
|
state: info
|
|
environment:
|
|
CEPH_CONTAINER_IMAGE: "{{ tripleo_cephadm_container_ns + '/' + tripleo_cephadm_container_image + ':' + tripleo_cephadm_container_tag }}"
|
|
CEPH_CONTAINER_BINARY: "{{ tripleo_cephadm_container_cli }}"
|
|
register: _rgw_keys
|
|
become: true
|
|
with_items:
|
|
- { name: "client.bootstrap-rgw", path: "/var/lib/ceph/bootstrap-rgw/{{ tripleo_cephadm_cluster }}.keyring", copy_key: true }
|
|
|
|
- name: Distribute Ceph keys to the nfs nodes
|
|
include_tasks: ganesha/distribute_keys.yaml
|
|
vars:
|
|
nfs_node: "{{ node }}"
|
|
rgw_keys: "{{ _rgw_keys }}"
|
|
loop: "{{ groups['ceph_nfs'] }}"
|
|
loop_control:
|
|
loop_var: node
|
|
|
|
- name: get dbus-1 file
|
|
command: |
|
|
{{ container_cli }} run --rm --entrypoint=cat \
|
|
{{ tripleo_cephadm_container_ns + '/' + tripleo_cephadm_container_image + ':' + tripleo_cephadm_container_tag }} \
|
|
/etc/dbus-1/system.d/org.ganesha.nfsd.conf
|
|
register: _dbus_ganesha
|
|
run_once: true
|
|
changed_when: false
|
|
|
|
- name: Render Ganesha templates and files
|
|
include_tasks: ganesha/start_nfs.yaml
|
|
vars:
|
|
nfs_node: "{{ node }}"
|
|
dbus_ganesha_file: "{{ _dbus_ganesha }}"
|
|
loop: "{{ groups['ceph_nfs'] }}"
|
|
loop_control:
|
|
loop_var: node
|