bifrost/playbooks/roles/bifrost-keystone-client-config/tasks/main.yml
Pavlo Shchelokovskyy e09bec2c83 Allow to create cloud.yaml with many clouds
This patch makes the bifrost-keystone-client-config role a bit more
generic to allow creating more that a single cloud configuration
setting.

The role is changed to accept a dict with possibly many clouds configurations,
and the template for clouds.yaml is changed accordingly.

This new functionality is used right away to add the keystone admin user
to the created clouds.yaml file to make the installed keystone usable
for admin-level operations (listing and editig users, projects, roles
and role assignments) - the name of the 'cloud' created is
'bifrost-admin'.

Change-Id: Icb274de989966645cd0f3874f8dff9d9f37d871b
2017-02-01 21:55:54 +02:00

46 lines
1.7 KiB
YAML

# 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: redefine cloud settings vars for backward compat
set_fact:
clouds:
bifrost:
config_username: "{{ config_username }}"
config_password: "{{ config_password }}"
config_project_name: "{{ config_project_name }}"
config_region_name: "{{ config_region_name }}"
config_auth_url: "{{ config_auth_url}}"
config_project_domain_id: "{{ config_project_domain_id|default('default') }}"
config_user_domain_id: "{{ config_user_domain_id|default('default') }}"
when:
- "{{ clouds is undefined }}"
- "{{ config_username is defined }}"
- "{{ config_password is defined }}"
- "{{ config_project_name is defined }}"
- "{{ config_region_name is defined }}"
- "{{ config_auth_url is defined }}"
- name: "Ensure the ~/.config/openstack/ exists"
file:
name: "~{{ user | default('root') }}/.config/openstack"
state: directory
owner: "{{ user }}"
mode: 0700
- name: "Write clouds.yaml configuration from template"
template:
src: clouds.yaml.j2
dest: "~{{ user | default('root') }}/.config/openstack/clouds.yaml"
owner: "{{ user }}"
mode: 0600