I am trying to use puppet to manage /etc/ipf/ipf.conf on ~800 clients. Most of the boxes use the same file, however, there are slight differences for some of them, so I have three types - default, typeA and typeB (to simplify) Here is my site.pp: # /etc/puppet/manifests/site.pp import "nodes/*" import "classes/*" node default { include ipf include sshd_conf include disable_rpcbind } Here is my nodes/typea.pp: # /etc/puppet/manifests/nodes/typea.pp node ''one'', ''two'', ''three'' { include typeA include sshd_conf include disable_rpcbind } Here is my nodes/typeb.pp: # /etc/puppet/manifests/nodes/typea.pp node ''four'', ''five'', ''six'' { include typeB include sshd_conf include disable_rpcbind } Here is my clases/typeA.pp: # /etc/puppet/manifests/classes/bigbox.pp class typeA { file { "/etc/ipf/ipf.conf": owner => "root", group => "sys", mode => 644, source => "puppet://10.1.2.208/files/etc/ipf/ipf.conf.typeA", alias => typeA } exec { typeA-restart: command => "/usr/sbin/ipf -Fa -f /etc/ipf/ipf.conf", logoutput => false, refreshonly => true, subscribe => File[typeA] } } And classes/typeB.pp: # /etc/puppet/manifests/classes/typeB.pp class tpf { file { "/etc/ipf/ipf.conf": owner => "root", group => "sys", mode => 644, source => "puppet://10.1.2.208/files/etc/ipf/ipf.conf.typeB", alias => typeB } exec { tpf-restart: command => "/usr/sbin/ipf -Fa -f /etc/ipf/ipf.conf", logoutput => false, refreshonly => true, subscribe => File[typeB] } } If I run puppetd on a typeA or typeB client, I see the following in the logs: "err: Could not retrieve catalog: Puppet::Parser::AST::Resource failed with error ArgumentError: Duplicate definition: File[/etc/ipf/ ipf.conf] is already defined in file /etc/puppet/manifests/classes/ typeA.pp at line 10; cannot redefine at /etc/puppet/manifests/classes/ typeB.pp:10 on node five" However, if I don''t use the nodes files (i.e. have everything in site.pp) it seems to work just fine. I''m sure there''s a way around this, I can''t imagine that no one else is managing a single file in different formats for different hosts, but I can''t seem to find any pertinent examples in the documentation. Thanks, Josh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Joshua Timberman
2008-Sep-15 18:26 UTC
[Puppet Users] Re: Sharing the same file for different nodes
On Mon, Sep 15, 2008 at 10:44 AM, josh <dorqus@gmail.com> wrote:> > class typeA { > file { "/etc/ipf/ipf.conf": > owner => "root", > group => "sys", > mode => 644, > source => "puppet://10.1.2.208/files/etc/ipf/ipf.conf.typeA", > alias => typeA > }Try this, replacing X with A, B etc. class typeX { file { "ipf-conf-typeX": path => "/etc/ipf/ipf.conf", ... } } -- Joshua Timberman "Patriotism has no party" - Barack Obama, DNC 2008. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Peter Meier
2008-Sep-15 19:14 UTC
[Puppet Users] Re: Sharing the same file for different nodes
Hi>> class typeA { >> file { "/etc/ipf/ipf.conf": >> owner => "root", >> group => "sys", >> mode => 644, >> source => "puppet://10.1.2.208/files/etc/ipf/ipf.conf.typeA", >> alias => typeA >> } > > Try this, replacing X with A, B etc. > class typeX { > file { "ipf-conf-typeX": > path => "/etc/ipf/ipf.conf", > ... > } > }or you can use only one class, set a type-variable _before_ including this class and add multiple sources depending on this type variable, or one source which depends on the type variable. greets pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Joshua, On Sep 15, 2:26 pm, "Joshua Timberman" <grumpysm...@gmail.com> wrote:> On Mon, Sep 15, 2008 at 10:44 AM, josh <dor...@gmail.com> wrote: > > > class typeA { > > file { "/etc/ipf/ipf.conf": > > owner => "root", > > group => "sys", > > mode => 644, > > source => "puppet://10.1.2.208/files/etc/ipf/ipf.conf.typeA", > > alias => typeA > > } > > Try this, replacing X with A, B etc. > class typeX { > file { "ipf-conf-typeX": > path => "/etc/ipf/ipf.conf", > ... > } > > } > > -- > Joshua Timberman > "Patriotism has no party" - Barack Obama, DNC 2008.Thank you, I will try that approach. It seems that I had a typo in one of my nodes/foo.pp files, and fixing that resolved the issue for now, but I like your approach. Josh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---