tripleo-ansible/tripleo_ansible/roles/tripleo-keystone-resources/tasks/clouds.yml

54 lines
1.9 KiB
YAML

---
# 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: "Check if {{ tripleo_keystone_resources_clouds_file_path }} exists"
become: true
stat:
path: "{{ tripleo_keystone_resources_clouds_file_path }}"
register: attr_clouds
# This task is required or config_template will fail if the src file didn't exist
- name: "Create empty {{ tripleo_keystone_resources_clouds_file_path }} if it does not exist"
become: true
copy:
content: |-
---
clouds: {}
dest: "{{ tripleo_keystone_resources_clouds_file_path }}"
when:
- not attr_clouds.stat.exists
- name: "Configure {{ tripleo_keystone_resources_clouds_file_path }}"
include_role:
name: tripleo-config
vars:
tripleo_config_dest: "{{ tripleo_keystone_resources_clouds_file_path }}"
tripleo_config_group: "{{ tripleo_keystone_resources_clouds_file_group }}"
tripleo_config_mode: "{{ tripleo_keystone_resources_clouds_file_mode }}"
tripleo_config_overrides: |-
{% set cloud_config = {'clouds': {}} %}
{% set _ = cloud_config['clouds'].__setitem__(
tripleo_keystone_resources_cloud_name,
tripleo_keystone_resources_cloud_config
)
%}
{{ cloud_config }}
tripleo_config_owner: "{{ tripleo_keystone_resources_clouds_file_owner }}"
tripleo_config_remote_src: true
tripleo_config_src: "{{ tripleo_keystone_resources_clouds_file_path }}"
tripleo_config_type: yaml