Browse Source

wait for deployment to finish and start a post-install playbook

master
Nicolas Massé 9 years ago
parent
commit
98bd40c5d0
  1. 11
      roles/sso/tasks/main.yml
  2. 6
      roles/sso/tasks/post-install.yml
  3. 9
      roles/sso/tasks/wait_for.yml
  4. 2
      roles/sso/vars/main.yml

11
roles/sso/tasks/main.yml

@ -87,7 +87,14 @@
# Update the secure route to use "Re-encrypt" instead of "Passthrough"
- include: update-route.yml
tags: update-route
- include: wait_for.yml
static: no
vars:
pod_to_wait:
- sso
tags: status
- name: Get Admin Username
command: oc get dc {{ sso_application_name }} -n "{{ sso_project }}" -o 'jsonpath={.spec.template.spec.containers[0].env[?(@.name=="SSO_ADMIN_USERNAME")].value}'
register: username
@ -109,3 +116,5 @@
- name: SSO is ready !
debug: msg="Login on https://{{ route.stdout }}/auth/admin with username = '{{ username.stdout }}' and password = '{{ password.stdout }}'"
tags: status
- include: post-install.yml

6
roles/sso/tasks/post-install.yml

@ -0,0 +1,6 @@
---
# TODO Steps :
# - register a client
# - use that client to authenticate (openid connect password flow)
# - use the REST APIs to administer RH-SSO

9
roles/sso/tasks/wait_for.yml

@ -0,0 +1,9 @@
---
- name: Wait for all pending deployments to become ready
command: 'oc get rc -o json -n "{{ sso_project }}"'
register: rc_state
changed_when: false
retries: "{{ sso_retries }}"
delay: "{{ sso_delay }}"
until: 'rc_state.stdout |from_json |json_query(''items[? status.replicas != `0` && (status.readyReplicas == ""|| status.readyReplicas == `0`) ].metadata.annotations."openshift.io/deployment-config.name"'') |intersect(pod_to_wait) |length == 0'

2
roles/sso/vars/main.yml

@ -15,3 +15,5 @@
sso_admin_username: admin
sso_application_name: sso
sso_service_username: cli
sso_retries: 30
sso_delay: 5

Loading…
Cancel
Save