Recently we have integrated push-jobs with chef to execute recipes from workstation itself. But here my question is how to execute single recipe on multiple nodes sequentially using push-jobs?.
Generally we can execute a recipe on a node with push-jobs using below command
knife job start ‘chef-client’ node-name (on one node).
but if i use like below command
knife job start ‘chef-client’ Node1 Node2 Node3 … the recipe executing on multiple nodes but it is executing parallelly on the multiple nodes.
No. we are just doing it in for loop
for node in (knife search "chef_environment:{environment} AND (role:zookeeper-platform)" | grep FQDN | cut -f2 -d":")
do
echo $node
knife job start chef_client node -q '1'
if [[ ( "{ACTION}" == "restart" ) && ( -z "${DRYRUN}" ) ]]
then
echo "restarting zookeeper"
knife job start restart_zookeeper $node -q '1'
sleep 10
fi
done