summaryrefslogtreecommitdiffstats
path: root/roles/openshift_cloud_provider
diff options
context:
space:
mode:
authorSylvain Baubeau <sbaubeau@redhat.com>2015-11-16 17:24:43 +0100
committerSylvain Baubeau <sbaubeau@redhat.com>2016-03-14 10:21:03 +0100
commitb5f00c416b767b167bbd3d8f61f2b9a534aa5432 (patch)
treecb16bdc8134ab1562191a0adf36bda7e7023a6a1 /roles/openshift_cloud_provider
parentdc8938e01202db0464e54becf4812c3191ce2d51 (diff)
downloadopenshift-b5f00c416b767b167bbd3d8f61f2b9a534aa5432.tar.gz
openshift-b5f00c416b767b167bbd3d8f61f2b9a534aa5432.tar.bz2
openshift-b5f00c416b767b167bbd3d8f61f2b9a534aa5432.tar.xz
openshift-b5f00c416b767b167bbd3d8f61f2b9a534aa5432.zip
Add support for Openstack integration
Diffstat (limited to 'roles/openshift_cloud_provider')
-rw-r--r--roles/openshift_cloud_provider/defaults/main.yml7
-rw-r--r--roles/openshift_cloud_provider/tasks/main.yml3
-rw-r--r--roles/openshift_cloud_provider/tasks/openstack.yml9
-rw-r--r--roles/openshift_cloud_provider/templates/openstack/cloud.conf.j217
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