Spes
2008-Apr-18 00:23 UTC
[Puppet Users] Env. variables, two operations on the same directory
Hi,
I''m new to Puppet, so maybe you find my two questions stupid.
- can I in easy way access custom system environment variables in
manifest files? and
- I would like to do some copy into one directory and then ensure that
this directory and only the directory permissions are OK, something
like this:
file {
''/etc/gdc/etc'': source =>
''/etc/puppet/fileserver/etc-gdc-etc'',
recurse => true, ignore =>
''.svn'', purge =>
true;
''/etc/gdc/etc'': mode => 700, owner =>
''root'', group => ''root'',
ensure => directory;
}
But the Puppet parser writes error:
| Puppet::Parser::AST::Resource failed with error ArgumentError:
Duplicate definition: File[/etc/gdc/etc] is already defined in file /
etc/puppet/manifests/ec2-common.pp at line 7; cannot redefine at /etc/
puppet/manifests/ec2-common.pp:7 on node vlasta
Using alias I get another error:
| info: /File[/etc/gdc/etc]: Adding aliases "gdc_etc"
| File[/etc/gdc/etc] is already being managed
Can I do something like this without executing external command or
create own module?
Thank you for any hints! Bye,
Vlasta
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Paul Lathrop
2008-Apr-18 01:25 UTC
[Puppet Users] Re: Env. variables, two operations on the same directory
On Thu, Apr 17, 2008 at 5:23 PM, Spes <Vlastimil.Holer@gmail.com> wrote:> - I would like to do some copy into one directory and then ensure that > this directory and only the directory permissions are OK, something > like this: > > file { > ''/etc/gdc/etc'': source => ''/etc/puppet/fileserver/etc-gdc-etc'', > recurse => true, ignore => ''.svn'', purge => > true; > ''/etc/gdc/etc'': mode => 700, owner => ''root'', group => ''root'', > ensure => directory; > } > > But the Puppet parser writes error: > | Puppet::Parser::AST::Resource failed with error ArgumentError: > Duplicate definition: File[/etc/gdc/etc] is already defined in file / > etc/puppet/manifests/ec2-common.pp at line 7; cannot redefine at /etc/ > puppet/manifests/ec2-common.pp:7 on node vlasta > > Using alias I get another error: > | info: /File[/etc/gdc/etc]: Adding aliases "gdc_etc" > | File[/etc/gdc/etc] is already being managed > > Can I do something like this without executing external command or > create own module?Not the way you are trying to do it. "recurse" means exactly that: ''apply these parameters to this item and all its children''. You would have to manage the directory without the recurse option, and its contents separately. Honestly, I think "recurse" is one of the worst things in Puppet; it does one thing well, but that thing seems to never be what people expect/want it to be. Does anyone get any real mileage out of recurse? --Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Spes
2008-Apr-18 07:41 UTC
[Puppet Users] Re: Env. variables, two operations on the same directory
Thank you, Paul. | - can I in easy way access custom system environment variables in manifest files? and And can I do this somehow? Or at least I need the functionality similar to $ cfengine -Dsomething Thank you, guys! Vlasta On Apr 18, 3:25 am, "Paul Lathrop" <p...@tertiusfamily.net> wrote:> On Thu, Apr 17, 2008 at 5:23 PM, Spes <Vlastimil.Ho...@gmail.com> wrote: > > - I would like to do some copy into one directory and then ensure that > > this directory and only the directory permissions are OK, something > > like this: > > > file { > > ''/etc/gdc/etc'': source => ''/etc/puppet/fileserver/etc-gdc-etc'', > > recurse => true, ignore => ''.svn'', purge => > > true; > > ''/etc/gdc/etc'': mode => 700, owner => ''root'', group => ''root'', > > ensure => directory; > > } > > > But the Puppet parser writes error: > > | Puppet::Parser::AST::Resource failed with error ArgumentError: > > Duplicate definition: File[/etc/gdc/etc] is already defined in file / > > etc/puppet/manifests/ec2-common.pp at line 7; cannot redefine at /etc/ > > puppet/manifests/ec2-common.pp:7 on node vlasta > > > Using alias I get another error: > > | info: /File[/etc/gdc/etc]: Adding aliases "gdc_etc" > > | File[/etc/gdc/etc] is already being managed > > > Can I do something like this without executing external command or > > create own module? > > Not the way you are trying to do it. "recurse" means exactly that: > ''apply these parameters to this item and all its children''. You would > have to manage the directory without the recurse option, and its > contents separately. > > Honestly, I think "recurse" is one of the worst things in Puppet; it > does one thing well, but that thing seems to never be what people > expect/want it to be. Does anyone get any real mileage out of recurse? > > --Paul--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Thomas Bellman
2008-Apr-18 08:25 UTC
[Puppet Users] Re: Env. variables, two operations on the same directory
Spes wrote:> | - can I in easy way access custom system environment variables in > manifest files? and > > And can I do this somehow? Or at least I need the functionality > similar to > $ cfengine -DsomethingI have done this with a custom facter module: ENV.each_pair do |var,value| Facter.add("env_"+var) do setcode do value end end end Put that in a file ending with the suffix ''.rb'' in a directory you point to with the --factpath flag to puppet. To send a "flag" to my Puppet manifests, I then run $ something=true puppet --factpath=`pwd`/facter site.pp and can check the variable $env_something in the manifests. (I have then encapsulated my running of puppet in a makefile which takes care of always passing the --factpath flag, and adding certain environment variables depending on the make target.) /Thomas Bellman --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Heydrick
2008-Apr-18 08:52 UTC
[Puppet Users] Re: Env. variables, two operations on the same directory
On Fri, 18 Apr 2008, Spes wrote:> Thank you, Paul. > > | - can I in easy way access custom system environment variables in > manifest files? and > > And can I do this somehow? Or at least I need the functionality > similar to > $ cfengine -DsomethingYou can set an environment variable FACTER_foo and access it as $foo in your manifest. -Eric --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Trevor Vaughan
2008-Apr-18 11:33 UTC
[Puppet Users] Re: Env. variables, two operations on the same directory
I''ve found the recurse option quite useful, but only after I modded
the Puppet code to support non-static operators.
For example:
file { ''/etc/pki/private'':
owner => root,
group => root,
recurse => true,
mode => ''go-rwx''
}
This keeps everybody out of my system''s PKI private keys (SSL for
apache, etc...).
It wasn''t really very handy except for ensuring the owner of all
sub-files otherwise.
I also ran into race conditions when I tried to separately manage
files under a recurse, but a dependency link fixed that.
Trevor
On Thu, Apr 17, 2008 at 9:25 PM, Paul Lathrop <paul@tertiusfamily.net>
wrote:>
> On Thu, Apr 17, 2008 at 5:23 PM, Spes <Vlastimil.Holer@gmail.com>
wrote:
> > - I would like to do some copy into one directory and then ensure
that
> > this directory and only the directory permissions are OK, something
> > like this:
> >
> > file {
> > ''/etc/gdc/etc'': source =>
''/etc/puppet/fileserver/etc-gdc-etc'',
> > recurse => true, ignore =>
''.svn'', purge =>
> > true;
> > ''/etc/gdc/etc'': mode => 700, owner =>
''root'', group => ''root'',
> > ensure => directory;
> > }
> >
> > But the Puppet parser writes error:
> > | Puppet::Parser::AST::Resource failed with error ArgumentError:
> > Duplicate definition: File[/etc/gdc/etc] is already defined in file
/
> > etc/puppet/manifests/ec2-common.pp at line 7; cannot redefine at
/etc/
> > puppet/manifests/ec2-common.pp:7 on node vlasta
> >
> > Using alias I get another error:
> > | info: /File[/etc/gdc/etc]: Adding aliases "gdc_etc"
> > | File[/etc/gdc/etc] is already being managed
> >
> > Can I do something like this without executing external command or
> > create own module?
>
> Not the way you are trying to do it. "recurse" means exactly
that:
> ''apply these parameters to this item and all its
children''. You would
> have to manage the directory without the recurse option, and its
> contents separately.
>
> Honestly, I think "recurse" is one of the worst things in
Puppet; it
> does one thing well, but that thing seems to never be what people
> expect/want it to be. Does anyone get any real mileage out of recurse?
>
> --Paul
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Evan Hisey
2008-Apr-18 12:27 UTC
[Puppet Users] Re: Env. variables, two operations on the same directory
On Fri, Apr 18, 2008 at 6:33 AM, Trevor Vaughan <peiriannydd@gmail.com> wrote:> > I''ve found the recurse option quite useful, but only after I modded > the Puppet code to support non-static operators. > > For example: > > file { ''/etc/pki/private'': > owner => root, > group => root, > recurse => true, > mode => ''go-rwx'' > } >I am assuming by non-static operators you mean the way you use the mode resource? If so, Please push that patch up stream to Luke. I know the octal number codes but it is so much easier to read with the letters. Evan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---