tripleo-ansible/tripleo_ansible/roles/tripleo_ceph_client_files/tasks/main.yml

49 lines
1.8 KiB
YAML

---
# Copyright 2022 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: Fail if tripleo_ceph_client_files_source is missing
fail:
msg: >-
tripleo_ceph_client_files_source must be set to a path that
already exists on the Ansible host which contains Ceph
configuration and Cephx key files.
when:
- tripleo_ceph_client_files_source is not defined or
(tripleo_ceph_client_files_source is defined and
tripleo_ceph_client_files_source | length < 1)
- name: Get list ceph files to copy from localhost tripleo_ceph_client_files_source
delegate_to: localhost
become: true
set_fact:
tripleo_ceph_client_dist: "{{ lookup('fileglob',
tripleo_ceph_client_files_source ~ '/*',
wantlist=True) | list }}"
- name: Ensure tripleo_ceph_client_config_home exists on all hosts
file:
path: "{{ tripleo_ceph_client_files_config_home }}"
state: directory
become: true
- name: Push files from tripleo_ceph_client_files_source to all hosts
become: true
copy:
src: "{{ item }}"
dest: "{{ tripleo_ceph_client_files_config_home }}/{{ item | basename }}"
mode: "{{ '600' if item | regex_search('.*.keyring$') else '644' }}"
loop: "{{ tripleo_ceph_client_dist }}"