![puppetlab'file_line'类型在一次puppet应用运行中不起作用](https://linux22.com/image/641940/puppetlab'file_line'%E7%B1%BB%E5%9E%8B%E5%9C%A8%E4%B8%80%E6%AC%A1puppet%E5%BA%94%E7%94%A8%E8%BF%90%E8%A1%8C%E4%B8%AD%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
当我运行 puppet apply policy1.pp 时,它不会应用 policy1.pp 中写入的所有 file_line 资源类型。因此,当我再次运行 puppet apply policy1.pp 时,它将应用 policy1.pp 中写入的剩余 file_line 资源。
为什么会出现这种情况?Puppet 无法在一次运行中应用所有资源。如果是文件资源,则不会发生这种情况。
答案1
我也遇到过这种情况。我踢了 puppet,它似乎应用了除 file_line 之外的所有配置,但它仍然不会在每次运行中应用它,直到我第二次手动踢 puppet 代理。
# puppet pluginsync=true
file { "/etc/puppet/puppet.conf":
mode => 644,
owner => root,
group => root,
source => "puppet:///modules/linuxstandard/puppet.conf.ic3",
}
# Turn off local resolution, handled by do_userinstall.sh
#file_line { 'dnsmasqoff':
# notify => Service["network-manager"],
# path => '/etc/NetworkManager/NetworkManager.conf',
# match => 'dns=dnsmasq',
# line => '#dns=dnsmasq',
# require => File['/etc/puppet/puppet.conf'],
#}
file_line { 'sshdns':
notify => Service["ssh"],
path => '/etc/ssh/sshd_config',
line => 'UseDNS no',
require => File["/etc/puppet/puppet.conf"],
}