Puppet: Error when trying to use many manifests

0 votes

I have written a module to setup a web server.I'm actually trying to apply multiple manifests.How can i use additional manifests in init.pp using the puppet apply command?

kp/manifests/init.pp:

class kp {
    include kp::testfile
}
include kp

kp/manifests/testfile.pp (additional manifest) 

define kp::testfile {
    $value = template("kp/some.erb")
    file { 'testfile':
        path    => '/tmp/my.txt',
        ensure  => file,
        content => $value
    }
}

As  per the Documentation i have tried to define a class in the module and declared that class by name in my manifest but when I run puppet apply init.pp I am getting error message

Could not find class kp::testfile for myhost.com at /myDir/puppetModules/kp/manifests/init.pp:2 on node vagrant.example.com

/myDir/puppetModules/ is in modulepath but where am i going wrong?

Aug 7 in Puppet by Tina
20 views

1 answer to this question.

0 votes

Your kp::testfile is a defined type, not a class. To use a defined type you need to declare it like:

kp::testfile { 'name': }

Try redefining kp::testfile like

class kp::testfile {
    $value = template("kp/some.erb")
    file { 'testfile':
        path    => '/tmp/my.txt',
        ensure  => file,
        content => $value
    }
}

This should work!

answered Aug 7 by Sirajul
• 25,260 points

Related Questions In Puppet

0 votes
1 answer

Error while trying to instal mssql tools using puppet

When you use puppet, you don't use ...READ MORE

answered Feb 25 in Puppet by Nandita
91 views
0 votes
0 answers
0 votes
1 answer

Does puppet forge have modules that i can use to Install LAMP stack?

Puppet forge has modules for installing and ...READ MORE

answered Jul 30 in Puppet by Sirajul
• 25,260 points
20 views
0 votes
1 answer

Error: Ruby run error after connecting puppet apply to PuppetDB.

If Puppet apply is configured incorrectly, this error is ...READ MORE

answered Jul 31 in Puppet by Sirajul
• 25,260 points
20 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
147 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer