Skip to content

@abhishekkr /common.csv
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Puppet Module : No Code In Data ~ Externalize Data into separately managed CSV files
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2.
# $MANIFESTPATH/extdatadir/common.csv
httpd_conf_dir,/etc/httpd/conf.d
httpd_is_cgi,true
httpd_git_path,/var/www/git
httpd_git_url,/mygit
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2.
# $MANIFESTPATH/extdatadir/env_testnode.csv
httpd_git_url,/testgit
# $MODULEPATH/httpd/manifests/git.pp
class httpd::git {
$conf_dir = extlookup('httpd_conf_dir')
$is_cgi = extlookup('httpd_is_cgi')
$path = extlookup('httpd_git_path')
$url = extlookup('httpd_git_url')
file {
"${conf_dir}/git.conf":
ensure => 'present',
content => template('httpd/mynode.conf.erb'),
}
}
# $MODULEPATH/httpd/templates/mynode.conf.erb
Alias <%= url %> <%= path %>
<Directory <%= path %>>
<% if is_cgi === 'true' %> # because from CSV any (boolean) value will be read as string
Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
<% end %>
</Directory>
puppet apply --environment=testnode --modulepath=$MODULEPATH --manifestdir=$MANIFESTPATH $MANIFESTPATH/site.pp
# $MANIFESTPATH/site.pp
$extlookup_datadir = "${settings::manifestdir}/extdatadir"
$extlookup_precedence = ["%{fqdn}", "env_%{environment}", "domain_%{domain}", "common"]
include httpd::git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.