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

10 lines
240 B
Django/Jinja

#!/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