Hi Chad, Greet to hear that my instinct was correct. As noted in the docs of puppet, using import is not recommended. So that's why I didn't want to use that either. So basically my configuration should be in modules. That was basically my biggest "problem".
Let's say I use a apache module from the puppet forge. So I include it in my module directories. Now I need to define which apache mods should be loaded, how the vhosts should look like, etc. Till now, I did that in one big manifest called site.pp. For only apache, that is acceptable. But if you use like 10 modules, that manifests gets too big as you also noted. Should I then create a module which is called like "apache settings" and in that module I configure everything? Or should I modify the original apache module? The latter sounds like best practice too, since it will hard to keep it up 2 date. If I write my own apache module, then of course I can activate any mods or vhosts within the same module. Basically, the alinea above and this line were my biggest problem. I am now going to check out the roles and profiles like you wrote down. Curious if this is going to answer all my questions. Thanks! - Peter Op zaterdag 21 december 2013 14:51:23 UTC+1 schreef Chad Huneycutt: > > Hi Peter, > Your instinct is correct. Just like many programming languages > that allow you to keep all of your code in one file (or one function, > even), it's not a good idea. As you mentioned, you can use import to > pull in other files, but the better solution is to use puppet's > autoloading functionality. The autoloader determines where to find > your classes based on the your modulepath and the the directory > structure in your module. So the answer to your question is that your > puppet code should mostly be in modules. There are a few approaches > to do that, but a lot of people have settled on a roles and profiles > pattern for describing nodes, with hiera being used for providing data > to the modules. > > It's not really something I can describe in a single email, but there > is a lot of info in blog entries and documentation. I've linked some > starting points below. If you follow their links, you'll get a much > better understanding. > > A full example: > > https://ask.puppetlabs.com/question/1655/an-end-to-end-roleprofile-example-using-hiera/ > > Some thoughts on module design: > > http://www.devco.net/archives/2012/12/13/simple-puppet-module-structure-redux.php > > > - Chad > > On Fri, Dec 20, 2013 at 1:15 PM, Peter Nijssen > <[email protected]<javascript:>> > wrote: > > I read that document, however, it doesn't provide me the answer. > > > > Should I write, in general, my own modules? Or should I use predefined > > modules? > > And I if use predefined modules, should the configuration of those > modules > > happen all in site.pp? (Which sounds me like a big file which is getting > > harder to read the more you need to configure). In the modules itself? > Or do > > you have to write modules which will start those modules? > > > > Op vrijdag 20 december 2013 19:04:33 UTC+1 schreef Christopher Wood: > >> > >> Looks like you might want to start here: > >> > >> > >> > http://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html > >> > >> Also check up on how to do hiera lookups from within puppet3. > >> > >> Other than that, structuring your modules tends to be a bit > >> site-dependent. > >> > >> On Fri, Dec 20, 2013 at 08:38:03AM -0800, Peter Nijssen wrote: > >> > Hi, > >> > I started to use vagrant with [1]puphpet. Very nice. However, the > gui > >> > of > >> > puphpet gives me too few options, so I want to configure > everything > >> > myself. > >> > So, I decided to write everything from scratch, using modules. > >> > Modules > >> > like apache, mysql, php, phpmyadmin which are in the puppet forge > etc > >> > etc. > >> > Now I need to configure those parts like which mods enabled for > >> > apache. > >> > Which vhost files. etc. > >> > Everything is done in the main manifest file called site.pp. > However, > >> > I > >> > was wondering, does it really has to become one gigantic file? > >> > Isn't it somehow better to split up? I noticed I can split up > using > >> > "import", but it's not really good practice apparently. > >> > I guess it's neither a good practice to somehow write it down in > the > >> > modules itself. > >> > Or isn't it really common to use existing modules and just write > your > >> > own? > >> > If I look around at github for default boxes, I see a lot of > people > >> > who > >> > all wrote the apache part on their own for example. > >> > Or do I have to write my own module, which splits everything up in > >> > classes. > >> > Basically what I want to achieve is that I seperate files where I > can > >> > configure apache, php, mysql etc etc. Or to hear what actually is > >> > best > >> > practice. I am only going to use it for one OS, so it doesn't have > to > >> > take > >> > a lot of OS'es into account. > >> > Thanks! > >> > Peter > >> > > >> > -- > >> > 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 [email protected]. > >> > To view this discussion on the web visit > >> > > >> > [2] > https://groups.google.com/d/msgid/puppet-users/9b216ae5-b811-46ce-a869-778d07d49717%40googlegroups.com. > > > >> > For more options, visit [3] > https://groups.google.com/groups/opt_out. > >> > > >> > References > >> > > >> > Visible links > >> > 1. https://puphpet.com/ > >> > 2. > >> > > https://groups.google.com/d/msgid/puppet-users/9b216ae5-b811-46ce-a869-778d07d49717%40googlegroups.com > > >> > 3. https://groups.google.com/groups/opt_out > > > > -- > > 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 [email protected] <javascript:>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/puppet-users/5c62d2f8-812a-4975-9337-8e45bdcf211d%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > Chad M. Huneycutt > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fbee4e10-d09e-4c0c-a800-d84e48678347%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
