How to parse same template with differen values each time

13 views
Skip to first unread message

Jordan Cabral

unread,
Nov 20, 2013, 1:24:25 PM11/20/13
to puppe...@googlegroups.com
Hi,
I need to parse a template, with different values, to generate different config files in each country I need to config.
The template is used inside a define, this define is used one time for each country.
I need that each time y execute this define, the vars used by the template have different values, depending on the parameter "country"

I cant find a nice solution for this (like using Hiera).
Actually I use a custom function that loads a key/value file on my scope each time y execute de define, and I change the key/value file using the parameter "country".

Example:

define tomcat::context(
    $path,
    $country,
){

    //My custom function I want to replace
    dynamicVariableCreator("context_${country}.conf")

    //This template needs to generate different content for each country
    file {"${path}_${country}.xml":
       content => template("context"),
       ensure  => present,
    }

}

Thanks
Reply all
Reply to author
Forward
0 new messages