From 435bbcb4af02ddedaa2ebcbea48b00f2bbf4d164 Mon Sep 17 00:00:00 2001
From: Kenny Woodson <kwoodson@redhat.com>
Date: Fri, 28 Jul 2017 17:31:21 -0400
Subject: First attempt at provisioning.

---
 roles/openshift_hosted/defaults/main.yml           |  3 +
 roles/openshift_hosted/tasks/registry/registry.yml | 58 ++++++++++----------
 roles/openshift_hosted/tasks/router/router.yml     | 64 +++++++++++-----------
 3 files changed, 66 insertions(+), 59 deletions(-)

(limited to 'roles/openshift_hosted')

diff --git a/roles/openshift_hosted/defaults/main.yml b/roles/openshift_hosted/defaults/main.yml
index 13cbfb14e..f0e303e43 100644
--- a/roles/openshift_hosted/defaults/main.yml
+++ b/roles/openshift_hosted/defaults/main.yml
@@ -5,6 +5,9 @@ r_openshift_hosted_router_use_firewalld: False
 r_openshift_hosted_registry_firewall_enabled: True
 r_openshift_hosted_registry_use_firewalld: False
 
+openshift_hosted_router_wait: True
+openshift_hosted_registry_wait: True
+
 registry_volume_claim: 'registry-claim'
 
 openshift_hosted_router_edits:
diff --git a/roles/openshift_hosted/tasks/registry/registry.yml b/roles/openshift_hosted/tasks/registry/registry.yml
index dcd9c87fc..40e6262f9 100644
--- a/roles/openshift_hosted/tasks/registry/registry.yml
+++ b/roles/openshift_hosted/tasks/registry/registry.yml
@@ -132,34 +132,36 @@
     edits: "{{ openshift_hosted_registry_edits }}"
     force: "{{ True|bool in openshift_hosted_registry_force }}"
 
-- name: Ensure OpenShift registry correctly rolls out (best-effort today)
-  command: |
-    oc rollout status deploymentconfig {{ openshift_hosted_registry_name }} \
-                      --namespace {{ openshift_hosted_registry_namespace }} \
-                      --config {{ openshift.common.config_base }}/master/admin.kubeconfig
-  async: 600
-  poll: 15
-  failed_when: false
-
-- name: Determine the latest version of the OpenShift registry deployment
-  command: |
-    {{ openshift.common.client_binary }} get deploymentconfig {{ openshift_hosted_registry_name }} \
-           --namespace {{ openshift_hosted_registry_namespace }} \
-           --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
-           -o jsonpath='{ .status.latestVersion }'
-  register: openshift_hosted_registry_latest_version
-
-- name: Sanity-check that the OpenShift registry rolled out correctly
-  command: |
-    {{ openshift.common.client_binary }} get replicationcontroller {{ openshift_hosted_registry_name }}-{{ openshift_hosted_registry_latest_version.stdout }} \
-           --namespace {{ openshift_hosted_registry_namespace }} \
-           --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
-           -o jsonpath='{ .metadata.annotations.openshift\.io/deployment\.phase }'
-  register: openshift_hosted_registry_rc_phase
-  until: "'Running' not in openshift_hosted_registry_rc_phase.stdout"
-  delay: 15
-  retries: 40
-  failed_when: "'Failed' in openshift_hosted_registry_rc_phase.stdout"
+- when: openshift_hosted_registry_wait
+  block:
+  - name: Ensure OpenShift registry correctly rolls out (best-effort today)
+    command: |
+      oc rollout status deploymentconfig {{ openshift_hosted_registry_name }} \
+                        --namespace {{ openshift_hosted_registry_namespace }} \
+                        --config {{ openshift.common.config_base }}/master/admin.kubeconfig
+    async: 600
+    poll: 15
+    failed_when: false
+
+  - name: Determine the latest version of the OpenShift registry deployment
+    command: |
+      {{ openshift.common.client_binary }} get deploymentconfig {{ openshift_hosted_registry_name }} \
+             --namespace {{ openshift_hosted_registry_namespace }} \
+             --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
+             -o jsonpath='{ .status.latestVersion }'
+    register: openshift_hosted_registry_latest_version
+
+  - name: Sanity-check that the OpenShift registry rolled out correctly
+    command: |
+      {{ openshift.common.client_binary }} get replicationcontroller {{ openshift_hosted_registry_name }}-{{ openshift_hosted_registry_latest_version.stdout }} \
+             --namespace {{ openshift_hosted_registry_namespace }} \
+             --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
+             -o jsonpath='{ .metadata.annotations.openshift\.io/deployment\.phase }'
+    register: openshift_hosted_registry_rc_phase
+    until: "'Running' not in openshift_hosted_registry_rc_phase.stdout"
+    delay: 15
+    retries: 40
+    failed_when: "'Failed' in openshift_hosted_registry_rc_phase.stdout"
 
 - include: storage/glusterfs.yml
   when:
diff --git a/roles/openshift_hosted/tasks/router/router.yml b/roles/openshift_hosted/tasks/router/router.yml
index 72a1ead80..e57ed733e 100644
--- a/roles/openshift_hosted/tasks/router/router.yml
+++ b/roles/openshift_hosted/tasks/router/router.yml
@@ -94,36 +94,38 @@
     stats_port: "{{ item.stats_port }}"
   with_items: "{{ openshift_hosted_routers }}"
 
-- name: Ensure OpenShift router correctly rolls out (best-effort today)
-  command: |
-    {{ openshift.common.client_binary }} rollout status deploymentconfig {{ item.name }} \
-                      --namespace {{ item.namespace | default('default') }} \
-                      --config {{ openshift.common.config_base }}/master/admin.kubeconfig
-  async: 600
-  poll: 15
-  with_items: "{{ openshift_hosted_routers }}"
-  failed_when: false
+- when: openshift_hosted_router_wait
+  block:
+  - name: Ensure OpenShift router correctly rolls out (best-effort today)
+    command: |
+      {{ openshift.common.client_binary }} rollout status deploymentconfig {{ item.name }} \
+                        --namespace {{ item.namespace | default('default') }} \
+                        --config {{ openshift.common.config_base }}/master/admin.kubeconfig
+    async: 600
+    poll: 15
+    with_items: "{{ openshift_hosted_routers }}"
+    failed_when: false
 
-- name: Determine the latest version of the OpenShift router deployment
-  command: |
-    {{ openshift.common.client_binary }} get deploymentconfig {{ item.name }} \
-           --namespace {{ item.namespace }} \
-           --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
-           -o jsonpath='{ .status.latestVersion }'
-  register: openshift_hosted_routers_latest_version
-  with_items: "{{ openshift_hosted_routers }}"
+  - name: Determine the latest version of the OpenShift router deployment
+    command: |
+      {{ openshift.common.client_binary }} get deploymentconfig {{ item.name }} \
+             --namespace {{ item.namespace }} \
+             --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
+             -o jsonpath='{ .status.latestVersion }'
+    register: openshift_hosted_routers_latest_version
+    with_items: "{{ openshift_hosted_routers }}"
 
-- name: Poll for OpenShift router deployment success
-  command: |
-    {{ openshift.common.client_binary }} get replicationcontroller {{ item.0.name }}-{{ item.1.stdout }} \
-           --namespace {{ item.0.namespace }} \
-           --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
-           -o jsonpath='{ .metadata.annotations.openshift\.io/deployment\.phase }'
-  register: openshift_hosted_router_rc_phase
-  until: "'Running' not in openshift_hosted_router_rc_phase.stdout"
-  delay: 15
-  retries: 40
-  failed_when: "'Failed' in openshift_hosted_router_rc_phase.stdout"
-  with_together:
-  - "{{ openshift_hosted_routers }}"
-  - "{{ openshift_hosted_routers_latest_version.results }}"
+  - name: Poll for OpenShift router deployment success
+    command: |
+      {{ openshift.common.client_binary }} get replicationcontroller {{ item.0.name }}-{{ item.1.stdout }} \
+             --namespace {{ item.0.namespace }} \
+             --config {{ openshift.common.config_base }}/master/admin.kubeconfig \
+             -o jsonpath='{ .metadata.annotations.openshift\.io/deployment\.phase }'
+    register: openshift_hosted_router_rc_phase
+    until: "'Running' not in openshift_hosted_router_rc_phase.stdout"
+    delay: 15
+    retries: 40
+    failed_when: "'Failed' in openshift_hosted_router_rc_phase.stdout"
+    with_together:
+    - "{{ openshift_hosted_routers }}"
+    - "{{ openshift_hosted_routers_latest_version.results }}"
-- 
cgit v1.2.3