尝试将hiera与木偶一起使用。我想知道如何将这样的东西移到Hiera:
定义:
define apache::namevirtualhost {
$addr_port = $name
# Template uses: $addr_port
concat::fragment { "NameVirtualHost ${addr_port}":
target => $apache::ports_file,
content => template('apache/namevirtualhost.erb'),
}
}
然后在我的super_node.pp中:
apache::namevirtualhost { '*:80': }
如何将'*:80'移至hiera json文件?这样的东西(似乎不起作用):
{
"apache::namevirtualhost" : "*:80"
}
同样的问题,如果我多次包含定义,我如何将配置移至hiera:
vagrant::box { 'dev.local':
sshport => '2223',
ip => '10.69.69.101'
}
vagrant::box { 'it.local':
sshport => '2224',
ip => '10.69.69.102'
}
只需在清单中使用hiera函数,因此在您的super_node.pp中:
$namevirtualhost = hiera("apache::namevirtualhost")
apache::namevirtualhost { $namevirtualhost : }
适合您的盒子:
vagrant::box { 'dev.local':
sshport => hiera("dev_local_sshport"),
ip => hiera("dev_local_ip"),
}
首先,您应确保通过键入
正确配置HIERA数据库hiera "apache::namevirtualhost"
来自command_line