diff options
Diffstat (limited to 'roles/openshift_cloud_provider')
4 files changed, 36 insertions, 0 deletions
diff --git a/roles/openshift_cloud_provider/defaults/main.yml b/roles/openshift_cloud_provider/defaults/main.yml new file mode 100644 index 000000000..6c7403232 --- /dev/null +++ b/roles/openshift_cloud_provider/defaults/main.yml @@ -0,0 +1,7 @@ +--- +ocp_os_auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}" +ocp_os_username: "{{ lookup('env', 'OS_USERNAME') }}" +ocp_os_password: "{{ lookup('env', 'OS_PASSWORD') }}" +ocp_os_tenant_id: "{{ lookup('env', 'OS_TENANT_ID') }}" +ocp_os_tenant_name: "{{ lookup('env', 'OS_TENANT_NAME') }}" +ocp_os_region: "{{ lookup('env', 'OS_REGION_NAME') }}" diff --git a/roles/openshift_cloud_provider/tasks/main.yml b/roles/openshift_cloud_provider/tasks/main.yml new file mode 100644 index 000000000..e14f944e8 --- /dev/null +++ b/roles/openshift_cloud_provider/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include: openstack.yml + when: "openshift_cloud_provider is defined and openshift_cloud_provider == 'openstack' and 'provider' in openshift and openshift.provider.name == 'openstack'" diff --git a/roles/openshift_cloud_provider/tasks/openstack.yml b/roles/openshift_cloud_provider/tasks/openstack.yml new file mode 100644 index 000000000..a56f1891a --- /dev/null +++ b/roles/openshift_cloud_provider/tasks/openstack.yml @@ -0,0 +1,9 @@ +- fail: + msg: "The Openstack integration requires OpenShift Enterprise 3.2 or Origin 1.2." + when: not openshift.common.version_gte_3_2_or_1_2 | bool + +- name: Create /etc/cloud.conf + template: + dest: /etc/cloud.conf + src: openstack/cloud.conf.j2 + when: ocp_os_auth_url and ocp_os_username and ocp_os_password and (ocp_os_tenant_id or ocp_os_tenant_name)
\ No newline at end of file diff --git a/roles/openshift_cloud_provider/templates/openstack/cloud.conf.j2 b/roles/openshift_cloud_provider/templates/openstack/cloud.conf.j2 new file mode 100644 index 000000000..388f3a735 --- /dev/null +++ b/roles/openshift_cloud_provider/templates/openstack/cloud.conf.j2 @@ -0,0 +1,17 @@ +[Global] +auth-url = {{ ocp_os_auth_url }} +username = {{ ocp_os_username }} +password = {{ ocp_os_password }} +{% if ocp_os_tenant_id %} +tenant-id = {{ ocp_os_tenant_id }} +{% else %} +tenant-name = {{ ocp_os_tenant_name }} +{% endif %} +{% if ocp_os_region %} +region = {{ ocp_os_region }} +{% endif %} +{% if ocp_os_lb_subnet_id is defined %} ++ ++[LoadBalancer] ++subnet-id = {{ ocp_os_lb_subnet_id }} ++{% endif %}
\ No newline at end of file |