Closed ctx closed 1 year ago
Ansible does not work this way:
Ansible needs a human-defined identifier to find the resources it creates.
You (and Ansible) cannot know the ID (UUID) generated by the API in advance. If you have already created a resource with an ID and want to use that ID in playbooks, the resource with that ID will not be recreated once the resource is deleted. So, there would be no idempotency.
There are modules in the AWS namespace I am aware of allow to give an ID but the ID has to be looked up by a name in a previous task, which we do in one task. Or hardcoded after the resource was created with the downside I already tried to explain.
That is why I am against implementing this "feature"
Thank you for your answer.
Some users might want to use fixed names for their resources in their playbooks:
Other users don't want to dig into the structure of return values to pass a uuid to another task:
Create a function that can compare
uuid
,name
or anobject
with a givenobject
.Spot all parameters that take only
name
,uuid
or anobject
and make it possible to use any.