- name: Run uri in a loop
  ansible.builtin.uri:
    url:https://cloudzone.net/api/{{ item }}/zone
  loop: '{{ response_cloud_id }}'

See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#standard-loops

On 3/7/24 6:43 PM, Mohammed Reehan wrote:
Hi Team

i have an array from my previous playbook and saving it as a fact called as
"ansible_facts"{
"response_cloud_id": [
"34eedfc",
"6733fdc"
  ]
},

I want to use this response_cloud_id for each object as a variable and pass into my URI module in the URL https://cloudzone.net/api/{{ <https://cloudzone.net/api/{{> response_cloud_id }}/zone how can I assign every element in the array to the URL loop through the array in the URL and make multiple calls till the array length is met?

Please help,

thanks
Reehan


--
Mohammed Rehan

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJOW%3Dx9%2B-LgbE0cE9yxhLg71S6ZH%3D_d3Wn8r2Mx7TxVYdsdc_g%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAJOW%3Dx9%2B-LgbE0cE9yxhLg71S6ZH%3D_d3Wn8r2Mx7TxVYdsdc_g%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
Todd

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/69574ef6-9e58-405a-885f-9a1ec22ac273%40gmail.com.

Reply via email to