Skip to content

Instantly share code, notes, and snippets.

@erbrito
Last active July 3, 2019 07:27
Show Gist options
  • Save erbrito/809c130334d0a83d5e34c77855b5e9c8 to your computer and use it in GitHub Desktop.
Save erbrito/809c130334d0a83d5e34c77855b5e9c8 to your computer and use it in GitHub Desktop.
Deploy of AWX (Ansible Tower) on OpenShift
mkdir Tower
cd Tower/
git clone https://github.com/ansible/awx.git
cd awx
cd installer/
#vi inventory
-# openshift_host=127.0.0.1:8443
-# awx_openshift_project=awx
-# openshift_user=developer
-# awx_node_port=30083
+ openshift_host=127.0.0.1:8443
+ awx_openshift_project=awx
+ openshift_user=developer
+ awx_node_port=30001
+# valid host port range 30000-32767
+ openshift_password=developer
# Standalone Docker Install
-postgres_data_dir=/tmp/pgdocker
-host_port=80
+#postgres_data_dir=/tmp/pgdocker
+#host_port=80
# Define if you want the image pushed to a registry. The container definition will also use these images
-# docker_registry=172.30.1.1:5000
-# docker_registry_repository=awx
-# docker_registry_username=developer
+ docker_registry=172.30.1.1:5000
+ docker_registry_repository=awx
+ docker_registry_username=developer
ansible-playbook -i inventory install.yml
#get the name of the AWX replica set
export RS_AWX = oc get rs|awk 'FNR>1 {print $1}'
oc scale --replicas=0 rs $RS_AWX
#add volume to the replicaset that will be mounted to awx-celery
oc patch rs $RS_AWX -p '{"spec":{"template":{"spec":{"volumes":[{"name":"awxprojectsdata","persistentVolumeClaim":{"claimName":"claim-awx"}}]}}}}'
#mount the volume to awx-celery
oc patch rs $RS_AWX -p '{"spec":{"template":{"spec":{"containers":[{"name":"awx-celery","volumeMounts":[{"mountPath":"/var/lib/awx/projects/","name":"awxprojectsdata"}]}]}}}}'
oc scale --replicas=1 rs $RS_AWX
@ryannix123
Copy link

What variable would I pass if I'm using an actual cluster with oAuth as the backend?

i.e., openshift_user=myOpenShiftToken?

@ryannix123
Copy link

TASK [kubernetes : OpenShift authentication failed on TLS verification] ******************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'openshift_auth_result.rc != 0' failed. The error was: error while evaluating conditional (openshift_auth_result.rc != 0): 'dict object' has no attribute 'rc'\n\nThe error appears to have been in '/Users/rtn361/Desktop/awx/installer/roles/kubernetes/tasks/openshift.yml': line 30, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: OpenShift authentication failed on TLS verification\n ^ here\n"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment