Fix check docker script to run only on manager nodes

This commit is contained in:
Przemek Grondek 2023-06-01 00:13:25 +02:00
parent 26bf4a2096
commit 3ae7fcf67e

View File

@ -1,5 +1,11 @@
#!/usr/bin/env bash #!/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' docker node inspect {{ ansible_hostname }} --format "{{ '{{' }} .Status.State {{ '}}' }}" | grep -q 'ready'
if [ $? == 1 ]; then if [ $? == 1 ]; then