I'm new to Chef / Kitchen. I'd like to change a line in a file on the target VM, such like /etc/sudoers
- change Defaults ...
.
That means, I don't want to use template
which would overwrite the file - I want to retain the other content of the file.
Ideally I would like some action like this:
file_changeLine '/path/to/file/' do
prefix: "Defaults .*"
end
Is there something such? I haven't found in docs. Maybe there are some additional repositories with community-made actions?
We really don't recommend this kind of management structure, but if you must, look at the poise-file
and line
cookbooks on Supermarket. They provide resource-based interfaces for delta updates. Just be aware that this will need a lot of care and feeding as it leads to generally brittle code.