Last active
May 16, 2016 12:43
-
-
Save fatmcgav/48d30a8a9b29d342035120528fec1767 to your computer and use it in GitHub Desktop.
Config_snippet defined type
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 microservice::config_snippet( | |
$file = $title, | |
$module = $caller_module_name, | |
$order = 'nil', | |
$template = true | |
) { | |
# Validate params | |
validate_string($file) | |
validate_bool($template) | |
# Check order | |
case $order { | |
'nil': { | |
$split_title = split($title, '-') | |
$order_REAL = $split_title[0] | |
} | |
default: { | |
$order_REAL = $order | |
} | |
} | |
# Source from template? | |
$content = $template ? { | |
true => template("${module}/config/${file}"), | |
false => $content | |
} | |
# Source from file? | |
$source = $template ? { | |
true => undef, | |
false => "puppet:///modules/${module}/${file}" | |
} | |
# Create the concat::fragment resource | |
concat::fragment { $file: | |
content => $content, | |
order => $order_REAL, | |
target => $microservice::config_file, | |
source => $source | |
} | |
} | |
# vi:syntax=puppet:filetype=puppet:ts=4:et: |
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
microservice::config_snippet { '50-config.txt.erb': | |
module => 'mod_a' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment