On Friday, October 11, 2013 11:24:44 AM UTC-5, mike wrote:
>
> Hello,
> I'm configuring my linux server with puppet open and is ok. My question is 
> the next; I've a declared in mi nodes.pp the next: 
>
> [.............]
> node 'basenode' {
>         include 'baseos'
>         include 'motd'
>         import 'useradd.pp'
> }
>
> #All nodes for my domain
> node /.*\.example\.com/ inherits basenode {
> }
>
> [.............]
>
> All nodes inherit basenode, Inside the class "baseos" i've declared the 
> archive host table and various other parameters
>
> [.............]
>
>     file { "/etc/hosts":
>                         ensure  => present,
>                         owner   => root,
>                         group   => root,
>                         mode    => '664',
>                         source  => "puppet:///modules/baseos/hosts",
>                 }
>
> [.............]
>
>
> But I need add other node in nodes.pp  and this need apply the class 
> baseos but without /etc/hots because this use other hosts table that I 
> declared as follows:
>
> [.............]
>
> node 'newnode.example.com' inherits basenode {
>         file { "/etc/hosts":
>                 ensure => "file",
>                 source => "puppet:///modules/baseos/newnode/hosts",
>                 mode   => "644",
>         }
> }
> [.............]
>
> But when I go newnode and run puppet give error for duplicate "/etc/hosts" 
> declaration  
>
> [.............]
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Duplicate declaration: File[/etc/hosts] is already declared in file 
> /etc/puppet/modules/baseos/manifests/config.pp:21; cannot redeclare at 
> /etc/puppet/manifests/nodes.pp:55 on node newnode.example.com
> [.............]
>
> How I can assign different tables hosts for different nodes in this case?
>
>

You need to do one of these things

   - modify your baseos class so that it does not manage /etc/hosts on 
   those nodes where you want to specify a different hosts file (and perhaps 
   not on *any* node), or
   - modify your baseos class so that it manages /etc/hosts correctly for 
   all nodes, and stop re-declaring that file in node blocks, or
   - stop assigning class baseos to those nodes for which it declares the 
   wrong /etc/hosts content (relying only on node blocks or on a different 
   class in those cases).

Implicit in all of the above is this:do not assign a class to a node if you 
don't want all the resources it declares.  (There is a last-ditch 
workaround for that, but it would cause you more harm than good at your 
level of Puppet experience.)

There are multiple ways to go about those, but I hesitate to suggest 
specifics without understanding why the new node is an exception to your 
general rule.


John

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to