1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00
awx/tools/scripts/ansible-tower
James Laska d47d2f5700 Add ansible-tower.{default,sysconfig} script
The 'ansible-tower' service script now comes with an additional file:

    /etc/{default,sysconfig}/ansible-tower

This file is used to specify the services managed by the 'ansible-tower'
service script.  The presence of this file allows admins (or the setup
playbook) to customize the services managed.  For example, when using a
remote postgres server, one would remove 'postgresql' from the list of
tower managed services.
2014-11-25 09:22:02 -05:00

67 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
#
# ansible-tower
#
# chkconfig: - 20 80
# description: support init to manage tower and its related services
### BEGIN INIT INFO
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: support init to manage tower and its related services
# Description: Ansible Tower provides an easy-to-use UI and dashboard, role-based access control and more for your Ansible initiative
### END INIT INFO
# Default configured services
if [ -e /etc/debian_version ]; then
TOWER_CONFIG="/etc/default/ansible-tower"
else
TOWER_CONFIG="/etc/sysconfig/ansible-tower"
fi
# Load default configuration
[ -e "${TOWER_CONFIG}" ] && . "${TOWER_CONFIG}"
service_action() {
for svc in ${TOWER_SERVICES}; do
service ${svc} $1
this_return=$?
if [ $this_return -gt $worst_return ]; then
worst_return=$this_return
fi
# Allow supervisor time to cleanup child pids (ubuntu only)
if [[ ${svc} == supervisor* && ${1} == stop && -e /etc/debian_version ]]; then
echo "Waiting to allow supervisor time to cleanup ..."
sleep 5
fi
done
}
worst_return=0
case "$1" in
start)
echo "Starting Tower"
service_action start
;;
stop)
echo "Stopping Tower"
service_action stop
;;
restart)
echo "Restarting Tower"
service_action stop
service_action start
;;
status)
echo "Showing Tower Status"
service_action status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac
exit $worst_return