ansible/roles/docker-cluster/templates/usr/local/sbin/check-docker.j2

10 lines
240 B
Plaintext
Raw Normal View History

2020-12-03 21:06:20 +00:00
#!/usr/bin/env bash
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