Passing argument to puppet using foreman smart class parameter

2.6k Views Asked by At

I'm trying to pass a yaml structure to a puppet class using foreman and smart class parameter.

My Yaml structure is defined as follow:

dumpCfg: 
    oracle: 
        DB_USERNAME: toto
        DUMP_TYPE: full
    mysql: 
        DB_USERNAME=titi
        DUMP_TYPE=full

I have to generate each file for each technology:

dump_oracle
    DB_USERNAME=toto
    DUMP_TYPE=full
dump_mysql
    DB_USERNAME=titi
    DUMP_TYPE=full

The definition of my class:

class bacula_client (

$isDirector    = false,
$isHostConcentrator = false,
$dumpCfg = '',
$hasOracle     = false,
$hasLdap       = false,
$data          = '',
$hasMongo      = false,
$hasMysql      = false,
$size          = 'SMALL',
$fileset       = 'common',
$schedule      = '',
$backupCrons   = []
) inherits bacula_client::params {


define foo($DB_USERNAME, $DUMP_TYPE) { 
  notify { "$title: got $DB_USERNAME and $DUMP_TYPE": } 
}

create_resources(foo, $dumpCfg)
}

I don't understand why this is not working, maybe I did not take the right way (do I have to add a parameter to my class?)

Thank you in advance,

I'm using puppet 2.7.

Smart Class Parameter with Foreman

0

There are 0 best solutions below