ansible / community

This repository is being archived. See https://github.com/ansible-community/presentations and https://github.com/ansible-community/meetings for the new locations
Apache License 2.0
489 stars 144 forks source link

Ansible Rescue Failed PUT API Task, and Redo as POST API Task #592

Closed Datadigital123 closed 3 years ago

Datadigital123 commented 3 years ago

Hello,

I am trying to run a PUT API call via Ansible URI module for a particular API Endpoint in my application, using a dictionary that contains the json files and that is defined as:

example: { 'example1' : 'v1', 'example2': 'v2''}


Given the task fails and I get a 4xx error when the api endpoint for the item does not exist, I want to run a POST command for that same json file or same {{item.key}} and {{item.value}} in reference to my specific JSON file.

How can I do this in ansible, to retry a task that failed but only specifically for that {{item.key}} and {{item.value}} in dictionary?

or

Is there a better way to do this to retry a failed PUT with a POST command

I want to use the ansible URI module

Thanks!

mkrizek commented 3 years ago

List Information

Hi!

Thanks very much for your interest in Ansible. It sincerely means a lot to us.

This appears to be a user question, and we'd like to direct these kinds of things to either the mailing list or the IRC channel.

If you can stop by there, we'd appreciate it. This allows us to keep the issue tracker for bugs, pull requests, RFEs and the like.

Thank you once again and we look forward to seeing you on the list or IRC. Thanks!