Peter I like your approach very much and think I'll implemente it :-)
TIA Paolo On Fri, Mar 21, 2014 at 6:48 PM, Peter Bukowinski <[email protected]> wrote: > It may not be the nicest way to handle it, but it's not all that > cumbersome. If your mount command is modifying the permissions, than you > can tell it to notify an exec resource that fixes the perms. > > 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'], > notify => Exec['fix_mount_perms'], > } > exec { 'fix_mount_perms': > command => 'chmod 2755 /app_dir && chown root:root /app_dir', > refreshonly => true, > } > > Setting the exec's refreshonly parameter to true prevents it from running > every time, but it will run any time the mount resource changes. > > -- > Peter Bukowinski > > On Mar 21, 2014, at 1:42 PM, Paolo Supino <[email protected]> wrote: > > Hi Guto > Too cumbersome: Have to setup a check for ownership, groupship and > permissions... :-( > > > On Fri, Mar 21, 2014 at 6:28 PM, guto carvalho <[email protected]>wrote: > >> 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<https://groups.google.com/d/msgid/puppet-users/CAHTbNE4ZLzh1Ojy7xsjCFaTXMSyPp-5AYYkwHNC2n4JeRuA5%3DA%40mail.gmail.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%2BB25ByT%3D2Rffaswtmpn-A_tUfV_VLSKwC8KD_UbvGvPM1vzng%40mail.gmail.com<https://groups.google.com/d/msgid/puppet-users/CA%2BB25ByT%3D2Rffaswtmpn-A_tUfV_VLSKwC8KD_UbvGvPM1vzng%40mail.gmail.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/773CA884-651C-4F22-BABE-4C1C2ADDD74F%40gmail.com<https://groups.google.com/d/msgid/puppet-users/773CA884-651C-4F22-BABE-4C1C2ADDD74F%40gmail.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%2BB25BxE%3DnMwhX_XA8C3ymc8_OK-9azHfY%3D6BzrxyYT2mqU0YA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
