xxxxxxxxxx
An API call or operation is idempotent if it has the same result
no matter how many times it is applied
xxxxxxxxxx
idempotency is an important Ansible feature.
It prevents unnecessary changes in the managed hosts.
With idempotency, you can execute one or more tasks on a server
as many times as you need to, but it won’t change anything
that’s already been modified and is working correctly.
To put it in basic terms, the only changes added are
the ones needed and not already in place.
All actions which modify states in Vault's APIs are idempotent. This means they're safe to retry and will produce exactly the same result despite having been requested before. Idempotency enables solutions to be built which are resilient to network and infrastructure problems, providing a better experience for the user.
Some requests can't determine whether you meant to make two identical calls or to retry a single call (for example upon making a transfer or payment). You can indicate this using the request_id field which is present in all state-modifying requests.
The value of this field must be unique for all distinct calls to the API. For this reason we suggest using something like UUIDv4 to ensure uniqueness.
When you want to:
Retry the same request, use the same request_id
Make a similar but distinct request, use a new value for the request_id
Determining whether or not to retry a request should be based on the HTTP response code. For further information, see the Status codes section in the Overview.