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,102 +21,97 @@
|
|||||||
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
|
- name: Deploy Tower
|
||||||
debug:
|
block:
|
||||||
msg: "oc path: {{ minishift_oc_bin }}"
|
- name: Login as admin
|
||||||
|
shell: "oc login -u system:admin"
|
||||||
|
|
||||||
- name: Login as admin
|
- name: Create privileged user service account awx
|
||||||
shell: "{{ minishift_oc_bin }} login {{ minishift_ip.stdout }}:8443 -u system:admin"
|
shell: "oc adm policy add-scc-to-user privileged system:serviceaccount:{{ awx_dev_project }}:awx"
|
||||||
|
|
||||||
- name: Create privileged user service account awx
|
- name: Unattach AWX dev tree volume locally
|
||||||
shell: "{{ minishift_oc_bin }} adm policy add-scc-to-user privileged system:serviceaccount:{{ awx_dev_project }}:awx"
|
shell: "minishift hostfolder remove awx || true"
|
||||||
|
|
||||||
- name: Authenticate with OpenShift via token
|
- name: Attach AWX dev tree volume locally
|
||||||
shell: "{{ minishift_oc_bin }} login {{ minishift_ip.stdout }}:8443 -u admin -p admin"
|
shell: "minishift hostfolder add -t sshfs --source {{ devtree_directory }} --target /mnt/sda1/awx awx"
|
||||||
|
|
||||||
- name: Unattach AWX dev tree volume locally
|
- name: Unmount AWX dev volume
|
||||||
shell: "minishift hostfolder remove awx || true"
|
shell: "minishift hostfolder umount awx || true"
|
||||||
|
|
||||||
- name: Attach AWX dev tree volume locally
|
- name: Mount AWX dev volume
|
||||||
shell: "minishift hostfolder add -t sshfs --source {{ devtree_directory }} --target /mnt/sda1/awx awx"
|
shell: minishift hostfolder mount awx
|
||||||
|
|
||||||
- name: Unmount AWX dev volume
|
- name: Get Project Detail
|
||||||
shell: "minishift hostfolder umount awx || true"
|
shell: "oc get project {{ awx_dev_project }}"
|
||||||
|
register: project_details
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Mount AWX dev volume
|
- name: Get Postgres Service Detail
|
||||||
shell: minishift hostfolder mount awx
|
shell: "oc describe svc postgresql -n {{ awx_dev_project }}"
|
||||||
|
register: postgres_svc_details
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Authenticate with OpenShift via token
|
- name: Create AWX Openshift Project
|
||||||
shell: "{{ minishift_oc_bin }} login -u admin -p admin"
|
shell: "oc new-project {{ awx_dev_project }}"
|
||||||
|
when: project_details.rc != 0
|
||||||
|
|
||||||
- name: Get Project Detail
|
- name: Stage serviceacct.yml
|
||||||
shell: "{{ minishift_oc_bin }} get project {{ awx_dev_project }}"
|
template:
|
||||||
register: project_details
|
src: serviceacct.yml.j2
|
||||||
ignore_errors: yes
|
dest: /tmp/serviceacct.yml
|
||||||
|
|
||||||
- name: Get Postgres Service Detail
|
- name: Apply svc account
|
||||||
shell: "{{ minishift_oc_bin }} describe svc postgresql -n {{ awx_dev_project }}"
|
shell: "oc apply -f /tmp/serviceacct.yml && rm -rf /tmp/serviceaccount.yml"
|
||||||
register: postgres_svc_details
|
|
||||||
ignore_errors: yes
|
|
||||||
|
|
||||||
- name: Create AWX Openshift Project
|
- name: Stage hostfolderpvc.yml
|
||||||
shell: "{{ minishift_oc_bin }} new-project {{ awx_dev_project }}"
|
template:
|
||||||
when: project_details.rc != 0
|
src: hostfolderpvc.yml.j2
|
||||||
|
dest: /tmp/hostfolderpvc.yml
|
||||||
|
|
||||||
- name: Stage serviceacct.yml
|
- name: Create PV for host folder
|
||||||
template:
|
shell: "oc apply -f /tmp/hostfolderpvc.yml && rm -rf /tmp/hostfolderpvc.yml"
|
||||||
src: serviceacct.yml.j2
|
|
||||||
dest: /tmp/serviceacct.yml
|
|
||||||
|
|
||||||
- name: Apply svc account
|
- name: Stage volumeclaim.yml
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/serviceacct.yml ; rm -rf /tmp/serviceaccount.yml"
|
template:
|
||||||
|
src: volumeclaim.yml.j2
|
||||||
|
dest: /tmp/volumeclaim.yml
|
||||||
|
|
||||||
- name: Stage hostfolderpvc.yml
|
- name: Create PV for host folder
|
||||||
template:
|
shell: "oc apply -f /tmp/volumeclaim.yml && rm -rf /tmp/volumeclaim.yml"
|
||||||
src: hostfolderpvc.yml.j2
|
|
||||||
dest: /tmp/hostfolderpvc.yml
|
|
||||||
|
|
||||||
- name: Create PV for host folder
|
- name: Deploy and Activate Postgres
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/hostfolderpvc.yml ; rm -rf /tmp/hostfolderpvc.yml"
|
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
|
||||||
|
register: openshift_pg_activate
|
||||||
|
|
||||||
- name: Stage volumeclaim.yml
|
- name: Wait for Postgres to activate
|
||||||
template:
|
pause:
|
||||||
src: volumeclaim.yml.j2
|
seconds: 15
|
||||||
dest: /tmp/volumeclaim.yml
|
when: openshift_pg_activate|changed
|
||||||
|
|
||||||
- name: Create PV for host folder
|
- name: Template configmap
|
||||||
shell: "oc apply -f /tmp/volumeclaim.yml ; rm -rf /tmp/volumeclaim.yml"
|
template:
|
||||||
|
src: configmap.yml.j2
|
||||||
|
dest: "/tmp/configmap.yml"
|
||||||
|
|
||||||
- name: Deploy and Activate Postgres
|
- name: Create configmap
|
||||||
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 apply -f /tmp/configmap.yml && rm -rf /tmp/configmap.yml"
|
||||||
when: postgres_svc_details is defined and postgres_svc_details.rc != 0
|
|
||||||
register: openshift_pg_activate
|
|
||||||
|
|
||||||
- name: Wait for Postgres to activate
|
- name: Template deployment
|
||||||
pause:
|
template:
|
||||||
seconds: 15
|
src: hostdev.yml.j2
|
||||||
when: openshift_pg_activate|changed
|
dest: "/tmp/hostdev.yml"
|
||||||
|
|
||||||
- name: Template configmap
|
- name: Create deployment
|
||||||
template:
|
shell: "oc apply -f /tmp/hostdev.yml && rm -rf /tmp/hostdev.yml"
|
||||||
src: configmap.yml.j2
|
|
||||||
dest: "/tmp/configmap.yml"
|
|
||||||
|
|
||||||
- name: Create configmap
|
- name: Please login
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/configmap.yml ; rm -rf /tmp/configmap.yml"
|
debug:
|
||||||
|
msg: "Login at https://{{ minishift_ip.stdout }}:8443 with admin / admin"
|
||||||
- name: Template deployment
|
environment:
|
||||||
template:
|
PATH: '{{ oc_path.stdout }}'
|
||||||
src: hostdev.yml.j2
|
|
||||||
dest: "/tmp/hostdev.yml"
|
|
||||||
|
|
||||||
- name: Create deployment
|
|
||||||
shell: "{{ minishift_oc_bin }} apply -f /tmp/hostdev.yml ; rm -rf /tmp/hostdev.yml"
|
|
||||||
|
|
||||||
- name: Please login
|
|
||||||
debug:
|
|
||||||
msg: "Login at https://{{ minishift_ip.stdout }}:8443 with admin / admin"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user