forked from redhat-cip/dci-openshift-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdci-openshift-agent-ctl
executable file
·62 lines (55 loc) · 1.34 KB
/
dci-openshift-agent-ctl
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
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
start=0
config=/etc/dci-openshift-agent/settings.yml
params="$(getopt -o hsc: -l help,start,config: --name "$(basename -- "$0")" -- "$@")"
function usage ()
{
name=$(basename -- "$0")
cat << EOF
Usage: $name [-h] [-s] [-c CONFIG] -- [ansible-playbook args]
arguments:
-h, --help Display this help message.
-s, --start Start the dci-openshift-agent.
-c CONFIG, --config CONFIG
Path to config file. default is /etc/dci-openshift-agent/settings.yml
EOF
exit 0
}
eval set -- "$params"
unset params
while true
do
case $1 in
-h|--help)
usage
;;
-s|--start)
start=1
shift
;;
-c|--config)
shift
config=$1
shift
;;
--)
shift
ansible_args=$@
break
;;
*)
usage
;;
esac
done
if [ $( id -u dci-openshift-agent ) -ne $( id -u ) ]; then
echo "must be run as the dci-openshift-agent user"
usage
fi
if [ "$start" -eq 1 ]; then
[ -e /etc/dci-openshift-agent/dcirc.sh ] && . /etc/dci-openshift-agent/dcirc.sh
[ -d /usr/share/dci-openshift-agent ] && cd /usr/share/dci-openshift-agent
ansible-playbook dci-openshift-agent.yml -e @$config $ansible_args
else
usage
fi