If your file `/volumes/vol1` could be managed by Puppet somehow, you
could use if defined(File['/volumes/vol1']) as a condition.
Not sure if it is possible in your case,
--
Yanis Guenane
On 08/19/2014 12:04 PM, Eugene Sapozhnikov wrote:
> Basicly I am looking for the syntax to use as a conditional in the
> if statement for a file exists check.
>
> On Monday, August 18, 2014 2:45:23 PM UTC-7, 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.
>>
>> Basic rough layout of what i would like to achieve is this:
>>
>> Any help on getting the correct syntax for the if statement would
>> be appreciated
>>
>>
>>
>> if file /volumes/vol1 exists { *exec { generate_loopback_tor:
>> command => "/sbin/losetup /dev/loop6 /volumes/tor", unless =>
>> "/sbin/losetup -a| /bin/grep \"/volumes/tor\"", } *
>>
>> *exec { generate_encrypt_tor: command => " /sbin/cryptsetup
>> create tor ", unless => "/usr/bin/test -e /dev/mapper/tor",
>> }exec { generate_mount_tor: command => "/bin/mount
>> /dev/mapper/tor /usr/local/tor", unless => "/bin/mount |
>> /bin/grep \"/usr/local/tor\"", } }* else { exec {