0

have written the following manifests using tidy resource to delete old war files

$ cat /home/kar/cleanwars.pp
   node 'node-010.example.com' {
        tidy { '/home/kar/temp/':
        path=> '/home/kar/temp/',
        age => '1w',
        recurse => true,
        matches => [ 'myapp-*.war','hisapp-*.war' ],
   }
 }

But I am seeing the following error when it is being executed.

2017-04-06 16:24:32,939 ERROR [qtp1760700677-69] [puppet-server] Puppet Node 'Node-010.example.com' is already defined at line 1; cannot redefine at line 9 on node Node-003.example.com

There is another manifests file (site.pp) on the same directory where we are using the same hosts as defined above . This manifests file is as follows

 $version="6.9"
 node default{
}

node 'node-003.example.com','node-010.example.com' {
file{"myapp.war":
    path   =>"/data/dist/apps/myapp-$version.war",
    ensure => present,
    group  => 'admin',
    owner  => 'tomcat',
    source => "puppet:///modules/helloworld/myapp-$version.war",
  }

Why I cannot use the same hostname in two different manifests file ?

Zama Ques
  • 523
  • 1
  • 9
  • 24

1 Answers1

0

A node cannnot have several declaration, you should define classes and use them in nodes declarations.

Using hiera, you can also assigned node classes based on condition like node name.

DevOps
  • 720
  • 5
  • 16