我正在尝试将参数从工头推送到我的 puppet 类以生成配置文件。
每个文件应该是这样的:
file1
DB_USERNAME=toto
DUMP_TYPE=full
[...]
file2
DB_USERNAME=toto
DUMP_TYPE=full
[...]
我在 Foreman 中定义了一个参数,它是一个哈希数组
bacula_client dumpCfg [{"techno"=>"oracle", "DB_USERNAME"=>"toto", "DUMP_TYPE"=>"full", ...},
{"techno"=>"mysql", "DB_USERNAME"=>"toto", "DUMP_TYPE"=>"full", ...}]
我想知道是否可以执行类似的操作来生成例如 2 个不同的配置文件,因为我在调用 dumpdb 时得到“资源标题必须是字符串”
class bacula_client (
$isDirector = false,
$backupCrons = [],
$isHostConcentrator = false,
$dumpCfg = [],
define bacula_client::dumpdb () {
$techno = $name['techno']
$dbusername = $name['DB_USERNAME']
$dumptype = $name['DUMP_TYPE']
# call a function that generates the files
}
[.....]
}#myclass
bacula_client::dumpdb{$dumpCfg:}
先感谢您,