ruby - How to configure or get Chef::Client if I have a Chef::Node with the API alone -
i have chef, workstation , nodes provisioned through hosted chef. need work on nodes in ruby script, not cookbook/recipe, using chef::search
query them.
i have array of chef::nodes
in script, , want handle on each node's chef-client can run recipe on each one. remember not doing regular chef run, need mimic chef run does: pulls down nodes, expands run_lists
, run recipes on them needed.
why?
because, not provisioning; need check status of nodes , select particular 1 run recipe on. nodes provisioned mongo , need maintenance replica set. cannot run sequential recipes , cannot run 1 of nodes.
so need is: given chef::node
got form chef::search::query
, how 1 chef-client
or load new chef::client
?
i have extensively looked @ api
, chef::client
class doesn't seem telling me how. there initialize , loadnode nothing takes node.
i think can lot of asking using knife-exec. allows you, if have api key, manipulate data on chef server ruby script. includes searches, nodes, roles , whatnot. use to mass updates of attributes on large numbers of nodes instead of doing knife node edit
hand.
this doesn't answer how run chef-client
on nodes though. perhaps run "ssh node1 sudo chef-client" or use knife-ssh
this.
Comments
Post a Comment