summaryrefslogtreecommitdiffstats
path: root/images/installer/root/usr/local/bin/run
diff options
context:
space:
mode:
authorjuanvallejo <jvallejo@redhat.com>2017-07-12 15:18:48 -0400
committerLuke Meyer <lmeyer@redhat.com>2017-07-18 14:02:10 -0400
commit5497673a7b5a7c07d3e99d77d028447acbdd36a5 (patch)
treecfda08c072b85c36570c218e6c2020621f264dba /images/installer/root/usr/local/bin/run
parent742203529902ba278c213e326f81f667304b9625 (diff)
downloadopenshift-5497673a7b5a7c07d3e99d77d028447acbdd36a5.tar.gz
openshift-5497673a7b5a7c07d3e99d77d028447acbdd36a5.tar.bz2
openshift-5497673a7b5a7c07d3e99d77d028447acbdd36a5.tar.xz
openshift-5497673a7b5a7c07d3e99d77d028447acbdd36a5.zip
image builds: remove dependency on playbook2image
We do not need the builder functionality from playbook2image and the resulting image was overly complicated, so this simply builds on Centos/RHEL.
Diffstat (limited to 'images/installer/root/usr/local/bin/run')
-rwxr-xr-ximages/installer/root/usr/local/bin/run46
1 files changed, 46 insertions, 0 deletions
diff --git a/images/installer/root/usr/local/bin/run b/images/installer/root/usr/local/bin/run
new file mode 100755
index 000000000..9401ea118
--- /dev/null
+++ b/images/installer/root/usr/local/bin/run
@@ -0,0 +1,46 @@
+#!/bin/bash -e
+#
+# This file serves as the default command to the openshift-ansible image.
+# Runs a playbook with inventory as specified by environment variables.
+#
+# For more information see the documentation:
+# https://github.com/openshift/openshift-ansible/blob/master/README_CONTAINER_IMAGE.md
+
+# SOURCE and HOME DIRECTORY: /opt/app-root/src
+
+if [[ -z "${PLAYBOOK_FILE}" ]]; then
+ echo
+ echo "PLAYBOOK_FILE must be provided."
+ exec /usr/local/bin/usage
+fi
+
+INVENTORY="$(mktemp)"
+if [[ -v INVENTORY_FILE ]]; then
+ # Make a copy so that ALLOW_ANSIBLE_CONNECTION_LOCAL below
+ # does not attempt to modify the original
+ cp -a ${INVENTORY_FILE} ${INVENTORY}
+elif [[ -v INVENTORY_URL ]]; then
+ curl -o ${INVENTORY} ${INVENTORY_URL}
+elif [[ -v DYNAMIC_SCRIPT_URL ]]; then
+ curl -o ${INVENTORY} ${DYNAMIC_SCRIPT_URL}
+ chmod 755 ${INVENTORY}
+else
+ echo
+ echo "One of INVENTORY_FILE, INVENTORY_URL or DYNAMIC_SCRIPT_URL must be provided."
+ exec /usr/local/bin/usage
+fi
+INVENTORY_ARG="-i ${INVENTORY}"
+
+if [[ "$ALLOW_ANSIBLE_CONNECTION_LOCAL" = false ]]; then
+ sed -i s/ansible_connection=local// ${INVENTORY}
+fi
+
+if [[ -v VAULT_PASS ]]; then
+ VAULT_PASS_FILE=.vaultpass
+ echo ${VAULT_PASS} > ${VAULT_PASS_FILE}
+ VAULT_PASS_ARG="--vault-password-file ${VAULT_PASS_FILE}"
+fi
+
+cd ${WORK_DIR}
+
+exec ansible-playbook ${INVENTORY_ARG} ${VAULT_PASS_ARG} ${OPTS} ${PLAYBOOK_FILE}