Puppet variables best practice, generalise or specialise?

Posted by Andrei Serdeliuc on Server Fault See other posts from Server Fault or by Andrei Serdeliuc
Published on 2013-08-02T14:24:33Z Indexed on 2013/08/02 15:41 UTC
Read the original article Hit count: 259

Filed under:

I'm trying to figure out which things should be in git within the puppet manifest and which should be in env vars like FACTER_my_var and use that in the manifest instead.

Scenario: you are deploying 3 php apps and you've already built all the layers up to the app in other manifests (base system, php extensions, users, etc), and all that's left is installing the correct app (from an apt repo) and creating a vhost.

I'm tempted to have something along the lines of:

apache::vhost { $::project_hostname:
    priority => '10',
    port => '80',
    docroot => $::project_document_root,
    logroot => "/var/log/apache2/${$::project_name}",
    serveradmin => '[email protected]',
    require => Package[httpd],
    ssl => false,
    override => 'all',
    setenv => ["APP_KERNEL dev"]
}

This would run on each server, and the FACTER_project_* vars would be set on a per server basis. An obvious restriction of this would be that you can't run more than one app with this specific example.

Or would you rather have project_x.pp, project_y.pp which have hardcoded paths and names?

© Server Fault or respective owner

Related posts about puppet