4 changed files with 80 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||||
|
--- |
||||
|
|
||||
|
- name: Deploy the exchanger application |
||||
|
hosts: itix |
||||
|
become: yes |
||||
|
vars: |
||||
|
itix_xch_route: xch.{{ openshift_master_default_subdomain }} |
||||
|
roles: |
||||
|
- { name: 'xch', tags: 'xch' } |
||||
@ -0,0 +1,6 @@ |
|||||
|
--- |
||||
|
|
||||
|
itix_xch_project: xch |
||||
|
itix_xch_template: minio |
||||
|
itix_xch_retries: 30 |
||||
|
itix_xch_delay: 5 |
||||
@ -0,0 +1,63 @@ |
|||||
|
--- |
||||
|
|
||||
|
- 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 Minio |
||||
|
command: oc new-project "{{ itix_xch_project }}" |
||||
|
when: '"projects/" ~ itix_xch_project not in oc_get_projects.stdout_lines' |
||||
|
|
||||
|
- name: Query existing deploymentconfigs |
||||
|
command: oc get dc -n "{{ itix_xch_project }}" -o name -l "app=minio" |
||||
|
register: oc_get_dc |
||||
|
changed_when: false |
||||
|
|
||||
|
- name: Deploy app if needed |
||||
|
set_fact: |
||||
|
deploy_needed: "{{ 'deploymentconfigs/minio' not in oc_get_dc.stdout_lines }}" |
||||
|
|
||||
|
- name: Process the OpenShift Template and create the OpenShift objects |
||||
|
command: oc new-app -n {{ itix_xch_project }} {{ itix_xch_template }} -p "MINIO_ROUTE_HOSTNAME={{ itix_xch_hostname }}" |
||||
|
when: deploy_needed |
||||
|
|
||||
|
- name: Wait for OpenShift to create all objects |
||||
|
pause: |
||||
|
seconds: '{{ itix_xch_delay }}' |
||||
|
when: deploy_needed |
||||
|
|
||||
|
- include: common/wait_for.yml |
||||
|
static: no |
||||
|
vars: |
||||
|
pod_to_wait: |
||||
|
- minio |
||||
|
delay: "{{ itix_xch_delay }}" |
||||
|
retries: "{{ itix_xch_retries }}" |
||||
|
project: "{{ itix_xch_project }}" |
||||
|
tags: status |
||||
|
|
||||
|
- name: Get Admin Username |
||||
|
command: oc get dc minio -n "{{ itix_xch_project }}" -o 'jsonpath={.spec.template.spec.containers[0].env[?(@.name=="MINIO_ACCESS_KEY")].value}' |
||||
|
register: username |
||||
|
changed_when: false |
||||
|
tags: status |
||||
|
|
||||
|
- name: Get Admin Password |
||||
|
command: oc get dc minio -n "{{ itix_xch_project }}" -o 'jsonpath={.spec.template.spec.containers[0].env[?(@.name=="MINIO_SECRET_KEY")].value}' |
||||
|
register: password |
||||
|
changed_when: false |
||||
|
tags: status |
||||
|
|
||||
|
- name: Get Route URL |
||||
|
command: oc get route minio -n "{{ itix_xch_project }}" -o 'jsonpath={.spec.host}' |
||||
|
register: route |
||||
|
changed_when: false |
||||
|
tags: status |
||||
|
|
||||
|
- set_fact: |
||||
|
xch_route_name: '{{ route.stdout }}' |
||||
|
|
||||
|
- name: Minio is ready ! |
||||
|
debug: msg="Login on https://{{ xch_route_name }}/ with username = '{{ username.stdout }}' and password = '{{ password.stdout }}'" |
||||
|
tags: status |
||||
Loading…
Reference in new issue