--- - name: Create an empty threescale_options variable if it does not exist set_fact: threescale_options: {} when: threescale_options is not defined tags: vars - name: Provision default values for the 3scale_options set_fact: threescale_options: "{{ threescale_default_options|combine(threescale_options) }}" tags: vars - name: Get a list of existing projects command: oc get projects -o name register: oc_get_projects changed_when: false - name: Create a new project for 3scale command: oc new-project "{{ threescale_options.project }}" when: '"project/" ~ threescale_options.project not in oc_get_projects.stdout_lines' - name: Process the OpenShift Template and create the OpenShift objects for the 3scale API Management Platform shell: oc process -f "{{ threescale_options.template }}" -p "TENANT_NAME={{ threescale_options.tenant_name }}" -p "WILDCARD_DOMAIN={{ threescale_options.wildcard_domain }}" | oc create -f - -n "{{ threescale_options.project }}" - include: status.yml tags: status - name: Deploy the storage tier (MySQL, Redis and Memcache) without any replicas command: oc rollout latest "{{ item }}" -n "{{ threescale_options.project }}" with_items: - backend-redis - system-memcache - system-mysql - system-redis when: item not in deployment_configs tags: rollout - name: Scale the storage tier (MySQL, Redis and Memcache) command: oc scale dc "{{ item }}" --replicas=1 -n "{{ threescale_options.project }}" with_items: - backend-redis - system-memcache - system-mysql - system-redis when: item not in replication_controllers tags: rollout - include: wait_for.yml static: no vars: pod_to_wait: - backend-redis - system-memcache - system-mysql - system-redis tags: status - name: Deploy the backend-listener without any replicas command: oc rollout latest "{{ item }}" -n "{{ threescale_options.project }}" with_items: - backend-listener when: item not in deployment_configs tags: rollout - name: Scale backend-listener command: oc scale dc "{{ item }}" --replicas=1 -n "{{ threescale_options.project }}" with_items: - backend-listener when: item not in replication_controllers tags: rollout - include: wait_for.yml static: no vars: pod_to_wait: - backend-listener tags: status - name: Deploy everything else without any replicas command: oc rollout latest "{{ item }}" -n "{{ threescale_options.project }}" with_items: - backend-listener - backend-worker - system-app - system-resque - system-sidekiq - backend-cron - system-sphinx - apicast-staging - apicast-production when: item not in deployment_configs tags: rollout - name: Scale system-app, system-resque and system-sidekiq command: oc scale dc "{{ item }}" --replicas=1 -n "{{ threescale_options.project }}" with_items: - system-app - system-resque - system-sidekiq when: item not in replication_controllers tags: rollout - include: wait_for.yml static: no vars: pod_to_wait: - system-app - system-resque - system-sidekiq tags: status - name: Scale backend-cron, backend-worker and system-sphinx command: oc scale dc "{{ item }}" --replicas=1 -n "{{ threescale_options.project }}" with_items: - backend-worker - backend-cron - system-sphinx when: item not in replication_controllers tags: rollout - include: wait_for.yml static: no vars: pod_to_wait: - backend-worker - backend-cron - system-sphinx tags: status - name: Deploy apicast-staging, apicast-production command: oc scale dc "{{ item }}" --replicas=1 -n "{{ threescale_options.project }}" with_items: - apicast-staging #- apicast-production when: item not in replication_controllers tags: rollout - include: wait_for.yml static: no vars: pod_to_wait: - apicast-staging #- apicast-production tags: status - name: Get Admin Username command: oc get dc system-app -n "{{ threescale_options.project }}" -o 'jsonpath={.spec.template.spec.containers[0].env[?(@.name=="USER_LOGIN")].value}' register: username changed_when: false tags: status - name: Get Admin Password command: oc get dc system-app -n "{{ threescale_options.project }}" -o 'jsonpath={.spec.template.spec.containers[0].env[?(@.name=="USER_PASSWORD")].value}' register: password changed_when: false tags: status - name: 3scale is ready ! debug: msg="Login on https://{{ threescale_options.tenant_name }}-admin.{{ threescale_options.wildcard_domain }} with username = '{{ username.stdout }}' and password = '{{ password.stdout }}'" tags: status