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

101 lines
3.4 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.
# "tripleo_ceph_client" will search for and load any operating system variable file
# found within the "vars/" path. If no OS files are found the task will skip.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- name: get the list of enabled services on the overcloud
set_fact:
tripleo_enabled_services: "{{ enabled_services | default([]) }}"
- include_tasks: fetch_dir.yml
name: Create ceph_client_fetch_dir
vars:
clean: true
build: true
- name: Check if the input variables exist
stat:
path: '{{ tripleo_ceph_client_vars }}'
register: ceph_input_vars
- name: Load variables produced by the cephadm provisioning process
include_vars: '{{ tripleo_ceph_client_vars }}'
when: ceph_input_vars.stat.exists == True
- name: Get Ceph Cluster variables if ceph-ansible deployed
include_tasks: ceph_ansible.yml
when:
- ceph_input_vars.stat.exists == False
- ceph_ansible_group_vars_all is defined
- name: Configure multiple external ceph clusters
include_tasks: multiple_external_ceph_clusters.yml
when:
- multiple is defined and multiple | length > 0
- include_tasks: create_keys.yml
name: Render keys provided for the Ceph cluster
vars:
ceph_keys: |
{% if tripleo_ceph_client_keys | length > 0 %}
{% set client_keys = tripleo_ceph_client_keys %}
{% elif keys is defined and keys is mapping %}
{% set client_keys = keys.get('keys', {}) %}
{% else %}
{% set client_keys = keys %}
{% endif %}
{{ client_keys }}
when:
- (tripleo_ceph_client_keys is defined) or (keys is defined)
- include_tasks: create_ceph_conf.yml
name: Render ceph config for the Ceph Clients
vars:
config_overrides: |
{% if tripleo_ceph_client_config_overrides is defined and tripleo_ceph_client_config_overrides | length > 0 %}
{% set overrides = tripleo_ceph_client_config_overrides %}
{% elif ceph_overrides is defined %}
{% set overrides = ceph_overrides.get('ceph_conf_overrides', {}) %}
{% else %}
{% set overrides = {} %}
{% endif %}
{{ overrides }}
- include_tasks: sync.yml
name: Configure Ceph Clients
- include_tasks: fetch_dir.yml
name: Clean ceph_client_fetch_dir
vars:
clean: true
build: false