file_line{'sysctl':
path => '/etc/mcp/templates/sysctl.conf_try',
line => "\n# Settings done for Hardening\n# Disable kernel core dump\nkern.coredump=0",
match => "^#[\s]+Settings[\s]+done[\s]+for[\s]+Hardening[\s]*[\n]+^#[\s]+Disable[\s]+kernel[\s]+core[\s]+dump[\s]*[\n]+kern.coredump",
}
Here I want to add 3 lines in file as below, if they does not exist.
# Settings done for Hardening
# Disable kernel core dump
kern.coredump=0
It works fine, if those 3 lines are not present means at that time those 3 lines get added to file.
But it does not work , when 3 lines are already present. In this case it is adding one more time those lines. So here it should not do anything.
↧