Ask Your Question
0

Puppet apply and structured manifests

asked 2015-09-17 11:38:20 -0600

T4ng10r gravatar image

updated 2015-09-17 14:51:39 -0600

Hi,

I'm completely new to puppet. Due to multiple system reinstalation and tedious and time-consuming configuration. Puppet seams to be the answer.

I created site.pp with lots of class. puppet apply worked fine.

Those classes were just asking to be split into separate files. import is depracated. Internet and examples suggest usage of directory environment. Most of examples refer to master-agent way of work.

Is it possible to achieve this with masterless puppet apply? If no - then how to do it?

OS: Debian 8 (stable), puppet 3.7.2

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-09-17 17:16:41 -0600

Ancillas gravatar image

Yes. You'll need to use Puppet modules. The concept is easy, and once you have that, you really just need to get down some naming conventions.

So, you'll have your manifests and modules directories. site.pp goes in the manifests directory. Your modules go in the modules directory.

Your site.pp might look like this.

include module1
include module2

And your directory structure would look like this (assuming Linux, but it's mostly the same if Windows).

/etc/puppet/
    manifests/
        site.pp
    modules/
        module1/
            files/
            manifests/
                init.pp
            modules/
            templates/
        module2/
            files/
            manifests/
                init.pp
            modules/
            templates/

An example of the module's init.pp file is a simple class.

class module1 (
  $param1,
) {
  # your code goes here
}
edit flag offensive delete link more

Comments

Thank you, your suggestion helped. puppet apply --noop -d --modulepath=/etc/puppet/modules site.pp do the trick

T4ng10r gravatar imageT4ng10r ( 2015-09-18 02:20:33 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-09-17 11:38:20 -0600

Seen: 230 times

Last updated: Sep 17 '15