ruby - Chef - Prevent execution of multiple resources -
let's have 3 execute
resources 'create users', 'install client' , 'verify client'.
how can prevent execution of resources if 1 condition satisfied ?
something like:
block 'manage client' execute 'create users' cwd scripts_path command './installclient.sh -create_users' end execute 'install client' cwd scripts_path command '/installclient.sh -installclient' end execute 'verify client' cwd scripts_path command './installclient.sh -verifyclient' end not_if { ::file.exists?('/tmp/client_configured_success') } end
use normal if/unless
conditional in other ruby code.
unless file.exist?('/tmp/client_configured_success') execute 'create users' cwd scripts_path command './installclient.sh -create_users' end execute 'install client' cwd scripts_path command '/installclient.sh -installclient' end execute 'verify client' cwd scripts_path command './installclient.sh -verifyclient' end end
Comments
Post a Comment