Chef provisioning - use SSH driver only if private ip exists


#1

I am using chef-zero on different workstations (and my machine objects are
not stored consistently)

I would like my machine recipe, to use SSH driver to provision a machine if
a machine with that private IP exists, and if not I want regular AWS driver
to be used…

ideas?


#2

Can you rub a little ruby on it?

if system("ping 127.0.0.1 -c 1")
  with_driver ‘ssh’
else
  with_driver ‘aws::us-west-1’
end

-T

On May 4, 2015, at 9:11 PM, Medya medya.gh@gmail.com wrote:

I am using chef-zero on different workstations (and my machine objects are not stored consistently)

I would like my machine recipe, to use SSH driver to provision a machine if a machine with that private IP exists, and if not I want regular AWS driver to be used…

ideas?