Browse Source

add playbooks to deploy xch (backed by minio)

master
Nicolas Massé 8 years ago
parent
commit
6b3d1f8206
  1. 9
      playbooks/deploy-xch.yml
  2. 2
      playbooks/site.yml
  3. 6
      roles/xch/defaults/main.yml
  4. 63
      roles/xch/tasks/main.yml

9
playbooks/deploy-xch.yml

@ -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' }

2
playbooks/site.yml

@ -17,3 +17,5 @@
- include: "deploy-prometheus.yml"
- include: "configure-openshift-access-control.yml"
- include: "deploy-xch.yml"

6
roles/xch/defaults/main.yml

@ -0,0 +1,6 @@
---
itix_xch_project: xch
itix_xch_template: minio
itix_xch_retries: 30
itix_xch_delay: 5

63
roles/xch/tasks/main.yml

@ -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…
Cancel
Save