-
Notifications
You must be signed in to change notification settings - Fork 33
/
entrypoint
executable file
·50 lines (40 loc) · 1.04 KB
/
entrypoint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
#
# Simple wrapper for executing ansible-galaxy and ansible-playbook.
#
# USAGE:
# ansible-playbook-wrapper [other ansible-playbook arguments]
#
# ENVIRONMENT VARIABLES:
#
# - PIP_REQUIREMENTS: pip requirements filename;
# default = "requirements.txt"
# - ANSIBLE_REQUIREMENTS: ansible requirements filename;
# default = "requirements.yml"
# - DEPLOY_KEY deploy key (private)
#
# Optional deploy key
#
if [ -z "$DEPLOY_KEY" ]; then
echo "${DEPLOY_KEY}" > /root/.ssh/id_rsa
fi
#
# install pip requirements, if any
#
if [ -z "$PIP_REQUIREMENTS" ]; then
PIP_REQUIREMENTS=requirements.txt
fi
if [ -f "$PIP_REQUIREMENTS" ]; then
pip install --upgrade -r $PIP_REQUIREMENTS
fi
#
# install Galaxy roles, if any
#
if [ -z "$ANSIBLE_REQUIREMENTS" ]; then
ANSIBLE_REQUIREMENTS=requirements.yml
fi
if [ -f "$ANSIBLE_REQUIREMENTS" ]; then
apk --no-cache --update add git
ansible-galaxy install -r $ANSIBLE_REQUIREMENTS
fi
exec "$@"