On Monday, August 18, 2014 4:45:23 PM UTC-5, Eugene Sapozhnikov wrote: > > > > I am trying to figure out a way to use a if statement to run multiple sets > of commands depending if one file exists, but I am unable to find any good > documented ways of doing this. > >
Your main alternatives are: 1) Add a file existence/nonexistence test to each Exec resource, in either its 'onlyif' or its 'unless' command. Of course, this is repetitive and it doesn't work for resources of other types than Exec. 1a) You could address at least the repetitiveness by wrapping up your separate commands into one (or more) scripts, and exec'ing that instead of execing each command individually. 2) You could create a custom fact that tests the file's existence (just before the beginning of each run). Then you could use that fact's value in your conditional logic. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5764223c-bb03-4403-96e5-ee3bfcbade50%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.