tripleo-ansible/tripleo_ansible/roles/tripleo_ceph_client/tasks/sync.yml

60 lines
2.2 KiB
YAML

---
# Copyright 2020 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: copy keys around
tags: 'ceph_client_rsync'
block:
- name: set effective ceph_clients without limit
set_fact:
tripleo_ceph_client_effective_clients: "{{ groups['ceph_client'] }}"
when:
- (ansible_limit is not defined) or (ansible_limit|length < 1)
- name: set effective ceph_clients with limit
include_tasks: effective_clients_limit.yml
vars:
client_group: "{{ groups['ceph_client'] }}"
when:
- (ansible_limit is defined) and (ansible_limit|length > 0)
# The ceph_external_multi_config usecase requires mon_client_hosts
# which is defined in roles/tripleo_ceph_work_dir/tasks/prepare.yml
- name: set distribution list from cross product of files and effective clients
set_fact:
tripleo_ceph_client_dist: "{{ lookup('fileglob',
tripleo_ceph_client_fetch_dir ~ '/*',
wantlist=True)
| product(mon_client_hosts|default([])
| union(tripleo_ceph_client_effective_clients | default([]))
| unique)
| list }}"
- name: Ensure /etc/ceph exists on all clients
become: true
file:
path: "{{ tripleo_ceph_client_config_home }}"
state: "directory"
delegate_to: "{{ item[1] }}"
loop: "{{ tripleo_ceph_client_dist }}"
- name: push files to the other nodes of cluster
become: true
copy:
src: "{{ item[0] }}"
dest: "{{ tripleo_ceph_client_config_home }}/{{ item[0] | basename }}"
delegate_to: "{{ item[1] }}"
loop: "{{ tripleo_ceph_client_dist }}"