Created
March 28, 2013 17:47
-
-
Save jonhattan/5265325 to your computer and use it in GitHub Desktop.
Pattern for creating non-homogeneous resource types in puppet from a hiera definition. Roundcube plugins as an use case. NOTE: filenames are intended to be a directory structure. Replace hypens with slashes.
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
class roundcube( | |
$dbprovider, | |
$dbuser = 'roundcube', | |
$dbpass = unset, | |
$dbname = 'roundcube') { | |
#... | |
$defaults = { | |
config => {}, | |
} | |
$plugins = hiera_hash('roundcube::plugins') | |
create_resources(roundcube::plugin, $plugins, $defaults) | |
#... | |
} |
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
define roundcube::plugin($config) { | |
if defined("roundcube::plugins::$name") { | |
$params = { "roundcube::plugins::$name" => $config } | |
create_resources('class', $params) | |
} | |
} |
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
class roundcube::plugins::password( | |
$password_driver, | |
$password_confirm_current, | |
$password_minimum_length, | |
$password_require_nonalpha, | |
$password_log, | |
) { | |
file { '/etc/roundcube/plugins/password/config.inc.php': | |
ensure => present, | |
content => template('roundcube/plugins/password/config.inc.php.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
roundcube::dbprovider : "mysql" | |
roundcube::dbpass : "secret" | |
roundcube::plugins: | |
compose_addressbook : {} | |
contextmenu : {} | |
listcommands : {} | |
quickrules : {} | |
sieverules : {} | |
vcard_attachments : {} | |
zipdownload : {} | |
password: | |
config: | |
password_driver : "sql" | |
password_confirm_current : true | |
password_minimum_length : 6 | |
password_require_nonalpha : true | |
password_log : false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment