避免手动添加主机作为属性
class::define { 'title': attribute3 => [ 'stone', 'wood' ], hosts => [ 'host1.domain', 'host2.domain' ] } class::define { 'title2': attribute3 => [ 'fire', 'water' ], hosts => [ 'host3.domaintwo', 'host4.domaintwo' ] }
通过使用导出的资源:
if $fqdn =~ /^.*\.domain$/ { @@class::define { 'title': attribute3 => [ 'stone', 'wood' ], hosts => $fqdn tag => 'test3' } } if $fqdn =~ /^.*\.domaintwo$/ { @@class::define { 'title2': attribute3 => [ 'fire', 'water' ], hosts => $fqdn tag => 'test4' } }
但这是行不通的
题
如何将导出的资源声明为属性?