Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been having a lot of fun coding with what puppet I have had experience with so far, and so far it looks like it can do most of what I need it to do.

One thing I am not finding in the documentation (with some searching) is how to (if it is possible) have pre-built configuration files to use on the servers. For example:

I use puppet to install httpd. Now we have apache on the client. Well now the httpd.conf needs some customization and specific settings. I have the httpd.conf I need to use on the puppet master. How do I get it from the puppet master to the client?

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

I went on the IRC channel for puppet, and found out this can be done with the source attribute.

file { "/etc/firewall.sh":
    owner => root,
    group => root,
    mode => 550,
    source => "puppet:///files/iptables.sh"
}

the location of files is set in /etc/puppet/fileserver.conf - the configuration there is straightforward.

The content tag instead of source can be used to put a literal string into the file.

share|improve this answer
add comment

If I were you, I'd use the puppet:///modules/<module name>/iptables.sh format. That way everything is confined to module and and you don't need a fileserver.conf. The puppet:///modules/* is free.

share|improve this answer
add comment

Using static files is a good start. Using templates is even better, and more flexible in the long run.

http://docs.puppetlabs.com/guides/templating.html

$hostname = 'your.host.com'
$portnum  = 8080

file { '/etc/lighttpd/lighttpd.conf':
   ensure => present,
  content => template('lighttpd/lighttpd.conf.erb'),
    owner => 'root',
    group => 'root',
     mode => 0644,
}

This combined with a .erb template creates the desired config file using the variables $hostname and $portnum.

$HTTP["host"] =~ "^<%= hostname %>" {
    proxy.server = (
        "" => (
            (
                "host" => "127.0.0.1",
                "port" => <%= portnum %>
            )
    ...
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.