Always write clouds.yaml

os-client-config can work for standalone mode with specifically written
clouds.yaml file providing auth_type as None.

This patch changes `bifrost-keystone-client-config` role to write
`clouds.yaml` file also when keystone is not installed, with a `bifrost`
cloud configured, so that users can write automation scripts
around ironic installed by bifrost in unified manner independently of
whether keystone is installed or not, by using

  openstack --os-cloud bifrost ...

command.

This effectively mimics current `env-vars` file in bifrost, but using
`clouds.yaml` configuration file.

Change-Id: I4c27ffed20b3d02723f7be99ccd61d8cee74bea1
This commit is contained in:
Pavlo Shchelokovskyy 2017-03-13 13:02:30 +02:00
parent 7164cbfbd8
commit de0a964e1a
6 changed files with 21 additions and 3 deletions

View File

@ -22,7 +22,6 @@
config_project_name: "{{ keystone.bootstrap.project_name }}"
config_region_name: "{{ keystone.bootstrap.region_name }}"
config_auth_url: "{{ keystone.bootstrap.public_url }}"
when: enable_keystone is defined and enable_keystone | bool == true
- { role: bifrost-create-dib-image, dib_imagename: "{{ http_boot_folder }}/ipa", build_ramdisk: false, dib_os_element: "{{ ipa_dib_os_element|default('debian') }}", dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}", when: create_ipa_image | bool == true }
- { role: bifrost-create-dib-image, dib_imagename: "{{ deploy_image }}", dib_imagetype: "qcow2", dib_elements: "vm enable-serial-console {{ dib_init_element|default('simple-init') }} {{ extra_dib_elements|default('') }}", when: create_image_via_dib | bool == true and transform_boot_image | bool == false }
environment:

View File

@ -1,2 +1,2 @@
---
# This file is intentionally empty
ironic_api_url: "http://localhost:6385"

View File

@ -23,6 +23,7 @@
config_project_domain_id: "{{ config_project_domain_id|default('default') }}"
config_user_domain_id: "{{ config_user_domain_id|default('default') }}"
when:
- "{{ enable_keystone | default(false) | bool }}"
- "{{ clouds is undefined }}"
- "{{ config_username is defined }}"
- "{{ config_password is defined }}"

View File

@ -1,5 +1,6 @@
# WARNING: This file is managed by bifrost.
clouds:
{% if (enable_keystone | default(false) | bool) %}
{% for cloud in clouds | default({}) | dictsort %}
{{ cloud.0 }}:
region_name: {{ cloud.1.config_region_name }}
@ -12,3 +13,9 @@ clouds:
user_domain_id: "{{ cloud.1.config_user_domain_id | default('default') }}"
identity_api_version: "3"
{% endfor %}
{% else %}
bifrost:
auth_type: None
auth: {}
url: {{ ironic_api_url }}
{% endif %}

View File

@ -87,7 +87,6 @@
config_project_name: "baremetal"
config_region_name: "{{ keystone.bootstrap.region_name }}"
config_auth_url: "{{ keystone.bootstrap.public_url }}"
when: "{{ enable_keystone is defined and enable_keystone | bool == true }}"
environment:
http_proxy: "{{ lookup('env','http_proxy') }}"
https_proxy: "{{ lookup('env','https_proxy') }}"

View File

@ -0,0 +1,12 @@
---
features:
- |
bifrost now always writes ``clouds.yaml`` configuration file
for os-client-config independently of whether keystone is installed
or not.
This allows unified usage of ironic-related openstackclient commands
both in presence and absence of installed keystone by using the
``openstack`` command in the following form for both situations::
openstack --os-cloud bifrost baremetal ...