我试图使用一个模板文件来创建Solaris 11 /etc/hosts.deny和/etc/hosts.allow文件,其中hiera数据位于data/Solaris.json。
如何使hosts.deny文件只包含"ALL: ALL",而hosts.allow包含"ALL: ALL“和--即Solaris.json文件中的变量内容?
应该注意的是,我的组织正在使用Puppet5.5开放源码,使用了ruby模板和json,而不是yaml。
这是舱单。
class etc::solaris_hosts_files (
Array[String] $entry,
) {
file { 'hosts.allow': # Creates /etc/hosts.allow using template.
ensure => 'present',
content => template('etc/solaris_hosts_template.erb'),
owner => 'root',
group => 'other',
path => '/etc/hosts.allow',
mode => '0444',
}
file { 'hosts.deny': # Creates /etc/hosts.deny using template.
ensure => 'present',
content => template('etc/solaris_hosts_template.erb'),
owner => 'root',
group => 'other',
path => '/etc/hosts.deny',
mode => '0444',
}
}这是模板文件。
ALL: ALL
<% unless $etc::solaris_hosts_files::hosts.allow -%>
<%= @entry.join(' ') %>下面是data/Solaris.json变量信息。
"etc::solaris_hosts_files::entry": [
"<some_net>:<some_mask>",
"<some_net>:<some_mask> #<some_hostname>" ],为了彻底起见,是的,@entry变量包含在data/common.json中。我们在Solaris.json中赋值。
"etc::solaris_hosts_files::entry": "",我是菜鸟木偶师。任何帮助都将不胜感激。谢谢你!!
发布于 2021-08-12 16:54:41
贴出对马特·舒查德问题的答案。
hosts.deny
ALL: ALL
hosts.allow:
ALL: ALL
<ip>:<mask>
<ip>:<mask>ip:掩码来自hiera数据。
呈现的结果是一个错误:
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: No content type in http response; cannot parse
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping runhttps://stackoverflow.com/questions/68759839
复制相似问题