Hi,
Below is the playbook, which work fine and create an ec2 instance inside the Public subnet inside my VPC and register the result inside the “ec2” variable, but the problem is sometime the “Associate new EIP to the NAT Instance” work and sometime fail, the reason is that, if the “Public subnet” result is at index 0, then it work and it come at index 1 then it fail, like this:
This work perfectly:
TASK: [NAT | Create the NAT Instance] ***********************
changed: [localhost → 127.0.0.1] => (item={u’resource_tags’: {u’Name’: u’tendo_public_subnet’}, u’cidr’: u’172.25.10.0/24’, u’az’: u’ap-southeast-2a’, u’id’: u’subnet-61549316’})
skipping: [localhost → 127.0.0.1] => (item={u’resource_tags’: {u’Name’: u’tendo_private_subnet’}, u’cidr’: u’172.25.20.0/24’, u’az’: u’ap-southeast-2b’, u’id’: u’subnet-68cb120d’})
but this fail:
TASK: [NAT | Create the NAT Instance] ***********************
skipping: [localhost → 127.0.0.1] => (item={u’resource_tags’: {u’Name’: u’tendo_private_subnet’}, u’cidr’: u’172.25.20.0/24’, u’az’: u’ap-southeast-2b’, u’id’: u’subnet-68cb120d’})
changed: [localhost → 127.0.0.1] => (item={u’resource_tags’: {u’Name’: u’tendo_public_subnet’}, u’cidr’: u’172.25.10.0/24’, u’az’: u’ap-southeast-2a’, u’id’: u’subnet-61549316’})
Can we make something that the public subnet result always come at 0 or 1 but not flip all the time?
Thanks