From 5bf152886bd7dea4942c396a1e4be041dfe8679a Mon Sep 17 00:00:00 2001 From: Jonathan Craig Date: Mon, 20 Aug 2018 12:51:25 -0400 Subject: [PATCH] add support for openstack trust to cloud provider config --- .../node/tasks/openstack-credential-check.yml | 11 +++++++++-- .../node/templates/openstack-cloud-config.j2 | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/roles/kubernetes/node/tasks/openstack-credential-check.yml b/roles/kubernetes/node/tasks/openstack-credential-check.yml index 8c535d966..6fc3110c9 100644 --- a/roles/kubernetes/node/tasks/openstack-credential-check.yml +++ b/roles/kubernetes/node/tasks/openstack-credential-check.yml @@ -21,5 +21,12 @@ - name: check openstack_tenant_id value fail: - msg: "openstack_tenant_id is missing" - when: openstack_tenant_id is not defined or openstack_tenant_id == "" + msg: "one of openstack_tenant_id or openstack_trust_id must be specified" + when: (openstack_tenant_id is not defined or openstack_tenant_id == "") and + openstack_trust_id is not defined + +- name: check openstack_trust_id value + fail: + msg: "one of openstack_tenant_id or openstack_trust_id must be specified" + when: (openstack_trust_id is not defined or openstack_trust_id == "") and + openstack_tenant_id is not defined diff --git a/roles/kubernetes/node/templates/openstack-cloud-config.j2 b/roles/kubernetes/node/templates/openstack-cloud-config.j2 index b6814b51b..cf9c74226 100644 --- a/roles/kubernetes/node/templates/openstack-cloud-config.j2 +++ b/roles/kubernetes/node/templates/openstack-cloud-config.j2 @@ -3,7 +3,11 @@ auth-url="{{ openstack_auth_url }}" username="{{ openstack_username }}" password="{{ openstack_password }}" region="{{ openstack_region }}" +{% if openstack_trust_id is defined and openstack_trust_id != "" %} +trust-id="{{ openstack_trust_id }}" +{% else %} tenant-id="{{ openstack_tenant_id }}" +{% endif %} {% if openstack_tenant_name is defined and openstack_tenant_name != "" %} tenant-name="{{ openstack_tenant_name }}" {% endif %}