Try to use paramters like unless, refreshonly or onlyinf to trigger the
command in specific conditions, not every time, inside your exec.

http://docs.puppetlabs.com/references/latest/type.html#exec-attributes
http://docs.puppetlabs.com/references/latest/type.html#exec-attribute-refreshonly
http://docs.puppetlabs.com/references/latest/type.html#exec-attribute-unless
http://docs.puppetlabs.com/references/latest/type.html#exec-attribute-onlyif


On Fri, Mar 21, 2014 at 2:19 PM, Paolo Supino <[email protected]>wrote:

> Hi Renan
>
> between the solutions I tried was something like this, only that the exec
> fix permissions got executed on every run of puppet...
>
>
> On Fri, Mar 21, 2014 at 5:53 PM, Renan Vicente <[email protected]>wrote:
>
>> you can use notify for a Exec and use a exec { 'fix permission':
>>
>>  command => 'chmod 0755 /app_dir ; chown root:root /app_dir'
>>                                                                    }
>> something like that, I didn't test but I guess that you work :D
>>
>>
>> On Friday, March 21, 2014 1:41:25 PM UTC-3, Paolo wrote:
>>>
>>> Hi
>>>
>>> I have the following problem: in a certain module I need to set
>>> permissions on a directory after the mount was executed. If I do the
>>> following
>>>
>>> file { '/app_dir':
>>>   ensure  => 'directory'
>>>   owner   => 'app_user'
>>>   group   => 'app_group'
>>>   mode   => '2775'
>>> } mount { '/app_dir':
>>>   ensure => mounted,
>>>   atboot => true,
>>>   device => /dev/mapper/lv_app,
>>>   fstype => ext3,
>>>   options => 'defaults',
>>>   dump => '1',
>>>   pass => '2',
>>>   require => File['/app_dir'],
>>> }
>>>
>>> This would require 2 rounds of puppet: round 1 to setup directory, mount
>>> the filesystem and round 2 to fix permissions set to root:root,0755 by the
>>> mount command...
>>>
>>> In looking for a solution I found the following link: https://projects.
>>> puppetlabs.com/issues/4815 that asks for the option to add permission
>>> settings to mount resource. The request was rejected and in the comments
>>>  Eric Sorenson writes that it would be trivial to accomplish with a
>>> defined type, but without going into details... :-( Can any one give me
>>> some details on how to do it with a defined type?
>>>
>>>
>>>
>>> TIA
>>> Paolo
>>>
>>>
>>>   --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/bc2954ad-6c52-4772-8f67-a22d98d81c56%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/bc2954ad-6c52-4772-8f67-a22d98d81c56%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
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CA%2BB25BzXeMtPFpbAK3f5MwjfXSGoZJC1%2BfzsQvyVbTZRjVjCbA%40mail.gmail.com<https://groups.google.com/d/msgid/puppet-users/CA%2BB25BzXeMtPFpbAK3f5MwjfXSGoZJC1%2BfzsQvyVbTZRjVjCbA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
[s]
Guto Carvalho

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAHTbNE4ZLzh1Ojy7xsjCFaTXMSyPp-5AYYkwHNC2n4JeRuA5%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to