Created
September 9, 2012 12:07
-
-
Save abhishekkr/3684010 to your computer and use it in GitHub Desktop.
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 in line 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $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 in line 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $MANIFESTPATH/extdatadir/env_testnode.csv | |
httpd_git_url,/testgit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $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'), | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puppet apply --environment=testnode --modulepath=$MODULEPATH --manifestdir=$MANIFESTPATH $MANIFESTPATH/site.pp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $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