Anyone used the Line cookbook --> https://supermarket.chef.io/cookbooks/line
I'm trying to add multiple lines to the rsyslog.conf file and using the line cookbook which was suggested earlier.
Contents of the recipe:
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
It fails with
================================================================================
Error executing action edit
on resource 'replace_or_add[New Lines]'
================================================================================
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
I tried using the tr -d '\n' < yourfile.txt as mentioned in How do I remove newlines from a text file? but it still fails with the same error. but it still fails with the same eror.
Anyone tested the line cook book for adding multiple lines to a rsysconfig file or even adding multiple lines to a file using this cookbook??
Thank you, Anish