【发布时间】:2019-01-23 20:00:19
【问题描述】:
任何人都使用过 Line 食谱 --> https://supermarket.chef.io/cookbooks/line
我正在尝试在 rsyslog.conf 文件中添加多行,并使用之前建议的 line cookbook。
食谱内容:
replace_or_add "New Lines" do
path "/etc/rsyslog.conf"
pattern "# ### end of the forwarding rule ###"
line "#audit log\n$ModLoad imfile\n$InputFileName /var/log/audit/audit.log\n$InputFileTag tag_audit_log:\n$InputFileStateFile audit_log\n$InputFileSeverity info\n$InputFileFacility local6\n$InputRunFileMonitor\n*.*"
end
它失败了
================================================ ==================================
在资源 'replace_or_add[New Lines]' 上执行操作 edit 时出错
==================================================== ===============================
ArgumentError
-------------
Line #audit log
$ModLoad imfile
$InputFileName /var/log/audit/audit.log
$InputFileTag tag_audit_log:
$InputFileStateFile audit_log
$InputFileSeverity info
$InputFileFacility local6
$InputRunFileMonitor
has embedded EOL characters, not allowed for this resource
我尝试使用How do I remove newlines from a text file? 中提到的 tr -d '\n'
有人测试了 line cook book 是否可以在 rsysconfig 文件中添加多行,甚至可以使用这本食谱在文件中添加多行??
谢谢你, 阿尼什
【问题讨论】:
标签: ruby chef-infra chef-recipe chef-solo cookbook