Add simple validation that OpenShift is deployed

Currently, we have no test to check if we actually deploy OpenShift
at the end of the scenario009 job. This can easily lead to false
positives from this job if some deploy step fails silently.

This patch adds two very basic commands to check if the OpenShift
cluster is actually operational.

Depends-On: Ibe94a58e0083b75e2f4cc904be6c17b0633d0293
Depends-On: Id24a7a0d9d34df4fd52ee1f99da61b873e5b870a
Depends-On: Ie21cc0dfed28353a13d419ff38cea82e65166221

Change-Id: Iee477ea736aff4290b703cd70258966819228c4a
This commit is contained in:
trown 2018-09-06 08:23:06 -04:00 committed by Martin André
parent ab24d472f1
commit df04ed9315
1 changed files with 65 additions and 0 deletions

View File

@ -353,6 +353,71 @@ outputs:
{% if tripleo_stack_action == 'CREATE' or (tripleo_stack_action == 'UPDATE' and (new_masters + new_nodes) | count == 0) %}
- include: "{{openshift_ansible_playbook_path}}"
{% endif %}
- name: Simple validation OpenShift is actually deployed
hosts: masters
tasks:
- name: Check oc status
command: oc status --suggest
register: oc_status
become: true
- name: Register failure if oc status fails
command: echo true
register: oc_status_failed
when: '"fail" in oc_status.stdout'
- debug:
var: oc_status.stdout_lines
- name: Check oc get dc/router
command: "oc get dc/router -o jsonpath='{.status.readyReplicas}'"
register: oc_get_router
become: true
- name: Register failure if oc get dc/router fails
command: echo true
register: oc_get_router_failed
when: 'oc_get_router.stdout|int < 1'
- debug:
var: oc_get_router.stdout
- name: Check oc get dc/docker-registry
command: "oc get dc/docker-registry -o jsonpath='{.status.readyReplicas}'"
register: oc_get_registry
become: true
- name: Register failure if oc get dc/docker-registry fails
command: echo true
register: oc_get_registry_failed
when: 'oc_get_registry.stdout|int < 1'
- debug:
var: oc_get_registry.stdout
- name: Check oc get nodes
command: oc get nodes --all-namespaces
register: oc_get_nodes
become: true
- name: Register failure if oc get nodes fails
command: echo true
register: oc_get_nodes_failed
when: '"NotReady" in oc_get_nodes.stdout'
- debug:
var: oc_get_nodes.stdout_lines
- name: Fail the playbook if any validations failed
fail:
when: >
oc_status_failed.changed or
oc_get_nodes_failed.changed or
oc_get_router_failed.changed or
oc_get_registry_failed.changed
- name: set openshift command
set_fact:
openshift_command: >-