16 lines
342 B
Django/Jinja
16 lines
342 B
Django/Jinja
#!/usr/bin/env bash
|
|
|
|
docker node ls
|
|
if [ $? == 1 ]; then
|
|
echo "This is not a docker swarm node exiting"
|
|
exit 1
|
|
fi
|
|
|
|
docker node inspect {{ ansible_hostname }} --format "{{ '{{' }} .Status.State {{ '}}' }}" | grep -q 'ready'
|
|
|
|
if [ $? == 1 ]; then
|
|
echo "Docker is down restarting"
|
|
service docker restart
|
|
else
|
|
echo "Docker is ok"
|
|
fi |