From 3ae7fcf67e670cd0e13d0f52d61af3b685bde856 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Thu, 1 Jun 2023 00:13:25 +0200 Subject: [PATCH] Fix check docker script to run only on manager nodes --- .../docker-cluster/templates/usr/local/sbin/check-docker.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/docker-cluster/templates/usr/local/sbin/check-docker.j2 b/roles/docker-cluster/templates/usr/local/sbin/check-docker.j2 index c31cfef..9f003fd 100644 --- a/roles/docker-cluster/templates/usr/local/sbin/check-docker.j2 +++ b/roles/docker-cluster/templates/usr/local/sbin/check-docker.j2 @@ -1,5 +1,11 @@ #!/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