Reputation: 1659
I have a scenario where I need to replace certain Strings in an attribute file within a cookbook with user input from within a Bash script.
In the current puppet setup this is done simply by using sed on the module files, since the modules are stored in the file structure as files and folders.
How can I replicate this in the Chef eco-system? Is there a known shortcut?
Or would I have to download the cookbook as a file using knife, modify the content and then re-upload again to make the changes?
Upvotes: 0
Views: 170
Reputation: 54211
Not sure this is the best approach. You can definitely use knife download
, sed
, and knife upload
as you mentioned but a better way would be to make it data driven. Either store the values in a data bag or role, and manipulate those either using knife or another API client. Then in your recipe code you can read out the values and use them.
Upvotes: 1