Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip unreachable nodes when using knife ssh

I'm trying to run a shell command on multiple nodes using knife ssh in a following way:

knife ssh -V "role:web" --ssh-gateway ec2-user@aws_ssh_gateway \
          --ssh-user ubuntu \
          "sudo chef-client"

It works fine when all my instances with role "web" are up, but when I take down only one instance this command hangs with this message:

WARNING: Failed to connect to  -- Net::SSH::Disconnect: connection closed by remote host

Is there a way to tell knife to just skip unreachable nodes and continue with ones that are up?

UPDATE: Knife should skip unreachable nodes by default but this does not happen. Possible reason is SSH gateway. Investigating.

like image 763
vlprans Avatar asked Nov 11 '22 23:11

vlprans


1 Answers

As of Chef 11, knife will just warn and skip unreachable nodes automatically.

like image 51
sethvargo Avatar answered Dec 06 '22 09:12

sethvargo