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, 2019 in Puppet by Tina
503 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, 2019 by Sirajul
• 59,230 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, 2019 in Puppet by Nandita
1,512 views
0 votes
1 answer
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, 2019 in Puppet by Sirajul
• 59,230 points
647 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,459 views
+2 votes
1 answer
0 votes
1 answer

Error: Puppet not found, when trying to run puppet config command.

This is because you have not added ...READ MORE

answered Sep 18, 2019 in Puppet by Sirajul
• 59,230 points
4,265 views
0 votes
1 answer

Puppet: Error while trying to execute shell commands in Exec resource type

The default exec provider on *nix OSes ...READ MORE

answered Aug 2, 2019 in Puppet by Sirajul
• 59,230 points
2,708 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP