mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Merge pull request #2857 from shanemcd/release_3.3.0
Fix / improve minishift dev env playbook
This commit is contained in:
commit
fb9e508b6b
@ -21,22 +21,18 @@
|
|||||||
shell: minishift oc-env
|
shell: minishift oc-env
|
||||||
register: minishift_oc_env
|
register: minishift_oc_env
|
||||||
|
|
||||||
- name: Extract minishift binary path
|
- shell: |
|
||||||
set_fact:
|
eval $(minishift oc-env)
|
||||||
minishift_oc_bin: "{{ minishift_oc_env.stdout_lines[0] | regex_replace('export PATH=\\\"(.*):\\$PATH\\\"', '\\1') }}/oc"
|
echo $PATH
|
||||||
|
register: oc_path
|
||||||
- name: Dynamically found oc binary to be at
|
|
||||||
debug:
|
|
||||||
msg: "oc path: {{ minishift_oc_bin }}"
|
|
||||||
|
|
||||||
|
- name: Deploy Tower
|
||||||
|
block:
|
||||||
- name: Login as admin
|
- name: Login as admin
|
||||||
shell: "{{ minishift_oc_bin }} login {{ minishift_ip.stdout }}:8443 -u system:admin"
|
shell: "oc login -u system:admin"
|
||||||
|
|
||||||
- name: Create privileged user service account awx
|
- name: Create privileged user service account awx
|
||||||
shell: "{{ minishift_oc_bin }} adm policy add-scc-to-user privileged system:serviceaccount:{{ awx_dev_project }}:awx"
|
shell: "oc adm policy add-scc-to-user privileged system:serviceaccount:{{ awx_dev_project }}:awx"
|
||||||
|
|
||||||
- name: Authenticate with OpenShift via token
|
|
||||||
shell: "{{ minishift_oc_bin }} login {{ minishift_ip.stdout }}:8443 -u admin -p admin"
|
|
||||||
|
|
||||||
- name: Unattach AWX dev tree volume locally
|
- name: Unattach AWX dev tree volume locally
|
||||||
shell: "minishift hostfolder remove awx || true"
|
shell: "minishift hostfolder remove awx || true"
|
||||||
@ -50,21 +46,18 @@
|
|||||||
- name: Mount AWX dev volume
|
- name: Mount AWX dev volume
|
||||||
shell: minishift hostfolder mount awx
|
shell: minishift hostfolder mount awx
|
||||||
|
|
||||||
- name: Authenticate with OpenShift via token
|
|
||||||
shell: "{{ minishift_oc_bin }} login -u admin -p admin"
|
|
||||||
|
|
||||||
- name: Get Project Detail
|
- name: Get Project Detail
|
||||||
shell: "{{ minishift_oc_bin }} get project {{ awx_dev_project }}"
|
shell: "oc get project {{ awx_dev_project }}"
|
||||||
register: project_details
|
register: project_details
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Get Postgres Service Detail
|
- name: Get Postgres Service Detail
|
||||||
shell: "{{ minishift_oc_bin }} describe svc postgresql -n {{ awx_dev_project }}"
|
shell: "oc describe svc postgresql -n {{ awx_dev_project }}"
|
||||||
register: postgres_svc_details
|
register: postgres_svc_details
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Create AWX Openshift Project
|
- name: Create AWX Openshift Project
|
||||||
shell: "{{ minishift_oc_bin }} new-project {{ awx_dev_project }}"
|
shell: "oc new-project {{ awx_dev_project }}"
|
||||||
when: project_details.rc != 0
|
when: project_details.rc != 0
|
||||||
|
|
||||||
- name: Stage serviceacct.yml
|
- name: Stage serviceacct.yml
|
||||||
@ -73,7 +66,7 @@
|
|||||||
dest: /tmp/serviceacct.yml
|
dest: /tmp/serviceacct.yml
|
||||||
|
|
||||||
- name: Apply svc account
|
- name: Apply svc account
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/serviceacct.yml ; rm -rf /tmp/serviceaccount.yml"
|
shell: "oc apply -f /tmp/serviceacct.yml && rm -rf /tmp/serviceaccount.yml"
|
||||||
|
|
||||||
- name: Stage hostfolderpvc.yml
|
- name: Stage hostfolderpvc.yml
|
||||||
template:
|
template:
|
||||||
@ -81,7 +74,7 @@
|
|||||||
dest: /tmp/hostfolderpvc.yml
|
dest: /tmp/hostfolderpvc.yml
|
||||||
|
|
||||||
- name: Create PV for host folder
|
- name: Create PV for host folder
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/hostfolderpvc.yml ; rm -rf /tmp/hostfolderpvc.yml"
|
shell: "oc apply -f /tmp/hostfolderpvc.yml && rm -rf /tmp/hostfolderpvc.yml"
|
||||||
|
|
||||||
- name: Stage volumeclaim.yml
|
- name: Stage volumeclaim.yml
|
||||||
template:
|
template:
|
||||||
@ -89,10 +82,10 @@
|
|||||||
dest: /tmp/volumeclaim.yml
|
dest: /tmp/volumeclaim.yml
|
||||||
|
|
||||||
- name: Create PV for host folder
|
- name: Create PV for host folder
|
||||||
shell: "oc apply -f /tmp/volumeclaim.yml ; rm -rf /tmp/volumeclaim.yml"
|
shell: "oc apply -f /tmp/volumeclaim.yml && rm -rf /tmp/volumeclaim.yml"
|
||||||
|
|
||||||
- name: Deploy and Activate Postgres
|
- name: Deploy and Activate Postgres
|
||||||
shell: "{{ minishift_oc_bin }} new-app --template=postgresql-persistent -e MEMORY_LIMIT={{ pg_memory_limit|default('512') }}Mi -e NAMESPACE=openshift -e DATABASE_SERVICE_NAME=postgresql -e POSTGRESQL_USER={{ pg_username|default('awx') }} -e POSTGRESQL_PASSWORD={{ pg_password|default('awx') }} -e POSTGRESQL_DATABASE={{ pg_database|default('awx') }} -e VOLUME_CAPACITY={{ pg_volume_capacity|default('5')}}Gi -e POSTGRESQL_VERSION=9.5 -n {{ awx_dev_project }}"
|
shell: "oc new-app --template=postgresql-persistent -e MEMORY_LIMIT={{ pg_memory_limit|default('512') }}Mi -e NAMESPACE=openshift -e DATABASE_SERVICE_NAME=postgresql -e POSTGRESQL_USER={{ pg_username|default('awx') }} -e POSTGRESQL_PASSWORD={{ pg_password|default('awx') }} -e POSTGRESQL_DATABASE={{ pg_database|default('awx') }} -e VOLUME_CAPACITY={{ pg_volume_capacity|default('5')}}Gi -e POSTGRESQL_VERSION=9.5 -n {{ awx_dev_project }}"
|
||||||
when: postgres_svc_details is defined and postgres_svc_details.rc != 0
|
when: postgres_svc_details is defined and postgres_svc_details.rc != 0
|
||||||
register: openshift_pg_activate
|
register: openshift_pg_activate
|
||||||
|
|
||||||
@ -107,7 +100,7 @@
|
|||||||
dest: "/tmp/configmap.yml"
|
dest: "/tmp/configmap.yml"
|
||||||
|
|
||||||
- name: Create configmap
|
- name: Create configmap
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/configmap.yml ; rm -rf /tmp/configmap.yml"
|
shell: "oc apply -f /tmp/configmap.yml && rm -rf /tmp/configmap.yml"
|
||||||
|
|
||||||
- name: Template deployment
|
- name: Template deployment
|
||||||
template:
|
template:
|
||||||
@ -115,8 +108,10 @@
|
|||||||
dest: "/tmp/hostdev.yml"
|
dest: "/tmp/hostdev.yml"
|
||||||
|
|
||||||
- name: Create deployment
|
- name: Create deployment
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/hostdev.yml ; rm -rf /tmp/hostdev.yml"
|
shell: "oc apply -f /tmp/hostdev.yml && rm -rf /tmp/hostdev.yml"
|
||||||
|
|
||||||
- name: Please login
|
- name: Please login
|
||||||
debug:
|
debug:
|
||||||
msg: "Login at https://{{ minishift_ip.stdout }}:8443 with admin / admin"
|
msg: "Login at https://{{ minishift_ip.stdout }}:8443 with admin / admin"
|
||||||
|
environment:
|
||||||
|
PATH: '{{ oc_path.stdout }}'
|
||||||
|
Loading…
Reference in New Issue
Block a user