如何使用Firewall DSC资源使用Puppet创建防火墙规则?
我想创建一个类,在我的虚拟机上创建新的防火墙规则。 我正在尝试利用DSC资源-防火墙。 我现在的班级在一个新的win_basic_firewall.pp中,看起来是这样的如何使用Firewall DSC资源使用Puppet创建防火墙规则?,puppet,parameter-splatting,Puppet,Parameter Splatting,我想创建一个类,在我的虚拟机上创建新的防火墙规则。 我正在尝试利用DSC资源-防火墙。 我现在的班级在一个新的win_basic_firewall.pp中,看起来是这样的 class osconfig::win_basic_firewall { if $dscmoduleversion != '' { $module = { 'name' => 'networkingdsc', 'version' => $dscmodul
class osconfig::win_basic_firewall {
if $dscmoduleversion != '' {
$module = {
'name' => 'networkingdsc',
'version' => $dscmoduleversion,
}
}else{
$module = 'networkingdsc'
}
$fwallow = lookup('myfirewall')
$fwallow.each |String $fwname, $rule|{
dsc { $fwname :
require => Dsc['PSModule networkingdsc'],
resource_name => 'Firewall',
module => $module,
properties => {
* => $rule
},
}
}
}
我有一个json配置文件,其中列出了我的规则。我现在有一个:
"myfirewall":{
"Newtestrule":{
"Name":"RDP test",
"Action": "Allow",
"Description": "This will allow RDP only from my IP",
"DisplayName": "My TEST rule RDP",
"Direction": "Inbound",
"Enabled":"True",
"Encryption": "NotRequired",
"Ensure": "Present",
"LocalPort": ["3389"],
"RemoteAddress": ["xx.xx.xx.xx/xx"],
"Protocol": "TCP"
}
},
在我的清单文件中,我只有一行
include osconfig::win_basic_firewall
当我的puppet代理在VM上运行时,我得到的是:
win_basic_firewall.pp, line: 18, column: 13
…这正是通过飞溅的线条
* => $rule
我做错了什么