问题
How can in configure the chef-client to know the run_list to run every 15min?
I start the chef-client run with "chef-client --local-mode -j run_list.json" which works as expected.
To provide a chef run every 15min, I add the chef client cookbook as dependency. In the log file I can see that the chef run starts (in local mode) every 15min, but the run_list is empty for every further run.
Where do I have to add the information that the second chef-run should use the same run-list as in the first run? I couldn`t find any place in the client.rb file.
回答1:
you can define you own attributes within a json file and use it as a part of the chef-client
run.
for instance, having an json file named attrs.json
that look like:
{
"run_list": [
"'recipe[base::default]'"
]
}
use chef-client
in conjunction with [--json-attributes
, something like:
chef-client --local-mode --json-attributes /path/to/attrs.json
or you can use chef-client
in conjunction with --runlist
chef-client --local-mode --runlist 'recipe[base::default]'
if the node_path
setting is used in chef-client
confiugration, client.rb, after chef-client
run, a node.json
file will be written to the node_path
, which can be used as a presistency for a periodically execution.
来源:https://stackoverflow.com/questions/61321449/where-do-i-have-to-specify-the-run-list-in-local-mode