So I thought of a workaround using nested loops shortly after posting this.
I'm going to leave this open because I think that being aware of retries in
runtime should be possible, but I wanted to post the solution for anyone
else stuck:
---
# file: tasks/main.yml
- name: Include API configuration items
include_tasks: configure_api_item.yml
loop: "{{ my_api_items }}"
loop_control:
loop_var: __api_item
---
# file: tasks/configure_api_item.yml
- name: Configure API item
uri:
url: <endpoint>
method: "{{ __method }}"
headers:
- <header1>
- <header2>
body: <body>
loop:
- POST
- PUT
register: __results
changed_when:
- __results.status is defined
- __results.status == 201
failed_when:
- __results.status is defined
- __results.status != 200
- __results.status != 201
- __results.status != 409
--
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/ef725d5a-0343-4252-9243-2c8bd1804ea8%40googlegroups.com.