mercredi 22 juillet 2020

How can i perform one to one mapping in chef using two array

I have array1 with elements [a1,a2,a3,a4....an] and array2 with elemet [b1,b2,b3,b4....bn] with same number of element. I how i can create a one to one mapping in chef for example (a1 with b1, a2 with b2) further i need to use there two elements for executing curl. Can you help me to figure out how to do this? I want to perform this in chef. I think about this

node[array1].each do |A|
  node[array2].each do |B|
    bash 'Curl Coomad' do
      code <<-EOH
      curl .....
      EOH
    end
  end
end

But this way it will run curl command for each and every member of A and B. But i want to use one to one mapping for running this command for ex a1 from A and b1 from B i want to use it for first execution and second time a2 and B2. Help me to figure this out

Aucun commentaire:

Enregistrer un commentaire