--- # Copyright 2019 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: create ceph-ansible temp dirs become: true file: path: "{{ item }}" state: directory owner: "{{ ansible_user }}" with_items: - "{{ playbook_dir }}/ceph-ansible" - "{{ playbook_dir }}/ceph-ansible/group_vars" - "{{ playbook_dir }}/ceph-ansible/host_vars" - "{{ playbook_dir }}/ceph-ansible/fetch_dir" - name: symbolic link to tripleo inventory from ceph-ansible work directory # If we call ceph-ansible with the same inventory as the calling # playbook, then config-download/groups_vars will be used instead # of config-download/ceph-ansible/group_vars. file: src: "{{ inventory_file }}" dest: "{{ playbook_dir }}/ceph-ansible/inventory.yml" state: link tags: - run_uuid_ansible - run_ceph_ansible - name: generate ceph-ansible group vars all copy: dest: "{{ playbook_dir }}/ceph-ansible/group_vars/all.yml" content: "{{ ceph_ansible_group_vars_all|to_nice_yaml }}" - name: generate ceph-ansible extra vars copy: dest: "{{ playbook_dir }}/ceph-ansible/extra_vars.yml" content: "{{ ceph_ansible_extra_vars | to_nice_yaml }}" - when: - ceph_external_multi_config is defined - (ceph_external_multi_config|length) > 0 block: - name: generate ceph-ansible extra vars foreach ceph in ceph_external_multi_config copy: dest: "{{ playbook_dir }}/ceph-ansible/external_{{ item.cluster }}_extra_vars.yml" content: "{{ item | default('') | to_nice_yaml }}" loop: "{{ ceph_external_multi_config }}" - name: get hosts of ceph_mon group and ceph_client group from inventory # Any host in the internal ceph cluster clients group and mon group # should also be a client of the additional external ceph cluster(s). # The clients group is sufficient if all cases are external, but if # default ceph-ansible run is internal, then roles with Ceph may not # include the CephClient service like the CephMon service found in the # Controller role. If the CephMon service is present, CephClient is # not necessary to get a key and conf file, but the additional runs # for the external Ceph cluster(s) do need the key and conf file on # the hosts in that role. set_fact: mon_client_hosts: "{{ mon_client_hosts | default([]) + [ item ] }}" with_inventory_hostnames: - ceph_client - ceph_mon - name: generate ceph-ansible/external_inventory.ini for ceph_external_multi_config # Build a new inventory where the collected hosts are only clients template: src: "external_inventory.ini.j2" dest: "{{ playbook_dir }}/ceph-ansible/external_inventory.ini"