From 04acad79ad6918cbf788f6b4336aa540bb58994b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Thu, 29 Jun 2017 16:55:06 +0200 Subject: [PATCH] deploy the OAuth test client --- roles/3scale/tasks/oauth-client.yml | 44 +++++++++++++++++++++++++++++ roles/3scale/tasks/post-install.yml | 5 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 roles/3scale/tasks/oauth-client.yml diff --git a/roles/3scale/tasks/oauth-client.yml b/roles/3scale/tasks/oauth-client.yml new file mode 100644 index 0000000..c4d332a --- /dev/null +++ b/roles/3scale/tasks/oauth-client.yml @@ -0,0 +1,44 @@ +--- + + - include: "common/status.yml" + vars: + project: "{{ threescale_project }}" + tags: status + + - set_fact: + deploy_needed: '{{ deployment_configs|intersect([ "oauth-client" ])|length < 1 }}' + tags: status + + - name: Get APICast (staging) URL + command: oc get route api-apicast-staging-route -n "{{ threescale_project }}" -o 'jsonpath={.spec.host}' + register: route + changed_when: false + when: deploy_needed + tags: status + + - set_fact: + apicast_hostname: '{{ route.stdout }}' + tags: vars + when: deploy_needed + + - name: Deploy the OAuth client + command: oc new-app -n '{{ threescale_project }}' https://github.com/3scale/apicast.git --name=oauth-client --context-dir=/examples/oauth2/client/ -e GATEWAY='https://{{ apicast_hostname }}' + when: deploy_needed + + - name: Expose the OAuth client + command: oc expose service oauth-client -n '{{ threescale_project }}' + when: deploy_needed + + - name: Get OAuth client URL + command: oc get route oauth-client -n "{{ threescale_project }}" -o 'jsonpath={.spec.host}' + register: route + changed_when: false + tags: status + + - set_fact: + oauth_client_hostname: '{{ route.stdout }}' + tags: vars + + - name: Patch the DeploymentConfig to add the REDIRECT_URI variable + command: oc env dc/oauth-client REDIRECT_URI='http://{{ oauth_client_hostname }}/callback' + when: deploy_needed diff --git a/roles/3scale/tasks/post-install.yml b/roles/3scale/tasks/post-install.yml index b2c62b8..c0c5e29 100644 --- a/roles/3scale/tasks/post-install.yml +++ b/roles/3scale/tasks/post-install.yml @@ -11,6 +11,9 @@ tags: vars - include: 3scale_status.yml - + - include: create_api.yml with_items: '{{ threescale_apis_to_create }}' + + - include: oauth-client.yml + tags: oauth-client