Im wondering if its possible with chef (or any other tool like puppet or ansible ...) to create cookbooks from current server configurations.

For example i have a red hat server with an jboss 7 running on it. Would it be possible to read that server configuration (users, groups, installed services) and the jboss configuration and create a cookbook from this configuration for further use and deployments of new server?

if its not possible with chef, does a 3rd party tool exists which can handle such a task?



If you remember what you did to configure stuff, you can write a cookbook.

You can copy your configs, but be aware, that this is overkill for a good cookbook. In an installation you want to change as little as possible, dumping the whole state of a configuration adds much stuff you did not change. This is bad, when a newer version comes with a newer config and you copy the old config (with old default values) instead of just adding your keys.

I do not think there is a fully automated way.

| improve this answer | |
  • +1 I essentially keep track of configuration changes and history, convert it to ansible playbooks and then test it again, not as familiar with chef but in ansible you make a role based on your jboss config, and set variables in the playbook – Jacob Evans Feb 7 '16 at 23:23
  • I use ansible and try to use things like "lineinfile", which trys to preserve as much as possible. Or the regex module to replace a commented out line by a activated (and maybe changed) line. Good thing is, that your ansible file keeps track what you changed, not only comments like ## my changes below – allo Feb 8 '16 at 0:18
  • I use jinja templates and always replace the configuration files. – Jacob Evans Feb 8 '16 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.