ScubaDude
2010-Aug-02 11:53 UTC
[Puppet Users] Mulitple Configuration Files and Permissions
Hi, I''m a puppet newbie so I don''t know what the best approach is. I''m trying to write a recipe for apache, there are multiple hosts each with different configurations in the environment so I was thinking of using $hostname and having each hosts config files in a seperate directory and using the recurse option to get all of the files. What I''m not sure about is how to set the correct ownership and permissions on the files. I think by default all the apache config files are owned by root with 644 permissions? If I add mode => 644, what will happen to sub directories? class httpd { package { httpd: ensure => latest } configfile { "/etc/httpd/conf/": source => [ "puppet://$server/modules/httpd/$hostname", "puppet://$server/modules/httpd/default", ], recurse => true, require => package["httpd"] } group { apache: gid => 48 } user { apache: comment => "Apache", uid => 48, gid => 48, home => "/var/www", shell => "/dev/null" } service { httpd: running => true, subscribe => [ file["/etc/httpd/conf/httpd.conf"], package["httpd"] ] } } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jeff McCune
2010-Aug-03 05:28 UTC
Re: [Puppet Users] Mulitple Configuration Files and Permissions
On Mon, Aug 2, 2010 at 4:53 AM, ScubaDude <brett.maton@googlemail.com> wrote:> Hi, > > I''m a puppet newbie so I don''t know what the best approach is. > I''m trying to write a recipe for apache, there are multiple hosts > each with different configurations in the environment so I was > thinking of using $hostname and having each hosts config files in a > seperate directory and using the recurse option to get all of the > files.You may want to have a look at the apache modules posted to http://forge.puppetlabs.com/ for inspiration as well. The general pattern for this type of thing is to use a defined resource type and encapsulate the configuration of each vhost. e.g. define apache::vhost ($port, $fqdn) { } You could start by using a file resource in the defined type to manage the virtual host''s configuration file in the conf.d directory.> What I''m not sure about is how to set the correct ownership and > permissions on the files. > I think by default all the apache config files are owned by root > with 644 permissions?It may vary by distribution, but owner => root, group => apache with mode => 0640 is quite sensible.> If I add mode => 644, what will happen to sub directories?When you do recurse => true, puppet will automatically set the execute bit if you''ve declared the readable bit to be set. Your files will be 0644 and your directories will be 0755 if the mode attribute takes on the value 0644 and recurse takes on the value true. -- Jeff McCune http://www.puppetlabs.com/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
ScubaDude
2010-Aug-03 10:59 UTC
[Puppet Users] Re: Mulitple Configuration Files and Permissions
Hi Jeff, Thanks for you input and clearing up the directory permissions query. I''ll scurry off and investigate the links you''ve provided. Thanks, Brett On Aug 3, 6:28 am, Jeff McCune <j...@puppetlabs.com> wrote:> On Mon, Aug 2, 2010 at 4:53 AM, ScubaDude <brett.ma...@googlemail.com> wrote: > > Hi, > > > I''m a puppet newbie so I don''t know what the best approach is. > > I''m trying to write a recipe for apache, there are multiple hosts > > each with different configurations in the environment so I was > > thinking of using $hostname and having each hosts config files in a > > seperate directory and using the recurse option to get all of the > > files. > > You may want to have a look at the apache modules posted tohttp://forge.puppetlabs.com/for inspiration as well. > > The general pattern for this type of thing is to use a defined > resource type and encapsulate the configuration of each vhost. e.g. > define apache::vhost ($port, $fqdn) { } You could start by using a > file resource in the defined type to manage the virtual host''s > configuration file in the conf.d directory. > > > What I''m not sure about is how to set the correct ownership and > > permissions on the files. > > I think by default all the apache config files are owned by root > > with 644 permissions? > > It may vary by distribution, but owner => root, group => apache with > mode => 0640 is quite sensible. > > > If I add mode => 644, what will happen to sub directories? > > When you do recurse => true, puppet will automatically set the execute > bit if you''ve declared the readable bit to be set. Your files will be > 0644 and your directories will be 0755 if the mode attribute takes on > the value 0644 and recurse takes on the value true. > > -- > Jeff McCunehttp://www.puppetlabs.com/-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.