Reputation: 1
As I am new to chef.I have done all the confirugation and installation part but when focusing on dynamic ie; runtime values not getting any idea.All cookbooks are generally harcoded but is there any generic way for dynamic value.I have taken help from How to pass attributes in chef-client without JSON file? https://docs.chef.io/knife_data_bag.html Chef Data Bags and dynamic variable passing d3.js noob : How to pass dynamic variable as data didn't get proper solutions. help me by providing some solutions
Upvotes: 0
Views: 927
Reputation: 271
If your question is either
You can not do such things. And its not chef's way. Chef is supposed to be run in non-interactive style with no user inputs at the run time. In fact, if you have a program which needs user inputs, you need to make it run non interactively or provide answers file. Now this answers file can be made dynamic with templates + attributes. Thats what you should do.
If you are looking for taking user inputs while running chef client though, you are better off considering tool such as Ansible which supports that. However, that will not make your scripts run on windows and so on.
Upvotes: 0
Reputation: 4223
Generally dynamic values are passed in via the node
, environment
, or roles
Each location allows you to set attributes on the node at various precedent levels. Alternately, you can also use databags, or calculate the values based on ohai data. With more details of your use case, we may be able to point you to the most appropriate solution.
Upvotes: 1