Generate a public environment file for accessing external APIs as admin

This commit is contained in:
Mark Goddard
2017-04-04 15:25:10 +01:00
parent d6f08f0c87
commit dcf5e39a4c
6 changed files with 53 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
# Path to kolla configuration directory.
public_openrc_kolla_config_path:
# URL of public keystone API to use for authentication.
public_openrc_auth_url:

View File

@@ -0,0 +1,10 @@
---
- name: Read the admin OpenStack API environment file
slurp:
src: "{{ kolla_config_path }}/admin-openrc.sh"
register: admin_openrc
- name: Ensure a public OpenStack API environment file exists
template:
src: public-openrc.sh.j2
dest: "{{ public_openrc_kolla_config_path }}/public-openrc.sh"

View File

@@ -0,0 +1,11 @@
# {{ ansible_managed }}
{% for line in (admin_openrc.content | b64decode).splitlines() %}
{% if "export OS_AUTH_URL" in line %}
export OS_AUTH_URL={{ public_openrc_auth_url }}
{% elif "export OS_INTERFACE" in line %}
export OS_INTERFACE=public
{% else %}
{{ line }}
{% endif %}
{% endfor %}