Search code examples
chef-infracookbooklwrp

Modify configuration files with Chef


I am writing a cookbook to install and configure an application. From what I googled, the best way to modify configuration, is to put a template of that config file. But an app can have different versions and config files may vary. What is the best solution here? Create a provider and a resource that will modify files in-place or create a ruby blocks that will handle the change? Thanks.


Solution

  • What we do is syncing the app cookbook version to app version.

    This cookbook is responsible to deploy the app and configure it, so the template is updated accordingly when version change.

    You don't give much information on what change there could be in the configuration file, usually the best bet is to have an exhaustive config and enabling or not parts of it based on attributes values to tweak it on the desired stated according to environment, role, version and so on.

    follow-up answer on the follow-up question