SSHKit doesn't prescribe how you connect to your servers, so if you have a
SSHKit::Host which has a special property ("tryFirst: true"), and then you
write a task which pre-flights that server, and that server alone, then you
are in luck, or in the naïve example below, split them into two lists

I would be tempted to make a Ruby class (or a function, your call) to
perform teh chef run, and do smoething like this:

checkHost = 'one'
hosts = %w{two three}

# could also be wrapped into a class
def chefit(context, host)
  context.on(host) do |h|
    return context.test("chef solo")
  end
end

task :chefit do
  # grab the first host, and see if this worked
  if chefit(binding, checkHost)
    chefit(binding, hosts)
  end
end

Something like this, (no warranty, haven't tested, etc)

Lee Hambley
--
http://lee.hambley.name/
+49 (0) 170 298 5667


On 11 May 2014 04:34, David Rodriguez <dav...@spindance.com> wrote:

> I am hoping somebody can point me to the proper way of accomplishing what
> I want to do.
>
> I have a list of servers that I need chef-client to be run on. The trick
> is that one of the servers needs to run first and if the chef run dies on
> it than nothing else should have chef run on it. I was hoping I could run
> it on the first server and check the exit status to determine if the run
> was successful. If appears that this isn't the case.
>
> I have tried various combinations but I can't get the result to determine
> if I should continue with the rest of the servers. I am starting to think
> that I just need to use the net-ssh library and manage all of the channels.
> I would love to use sshkit as I think it's a slick tool.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to capistrano+unsubscr...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/capistrano/2787480a-217f-4449-8672-3ff69d27b8cb%40googlegroups.com<https://groups.google.com/d/msgid/capistrano/2787480a-217f-4449-8672-3ff69d27b8cb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capistrano+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/CAN_%2BVLXS%3D9m28AmAayS4QcxFYPQDew%3DwwSYB9zg0SMh6i%2B7S0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to