I am trying to create a role for aws vpc creation. one of the task is to 
create an elastic ip address and  associate that ip address to nat gateway 
instance. if i run multiple times playbook it is recreating elastic ip but 
i would like to find a viable solution to make it idempotent. Please can 
you let me know if any solution. I appreciate your feeedback.

ec2_eip and ec2_vpc_nat_gateway modules is been used.

Sample code:

- name:                         Create elastic ip for NAT Gateway
  ec2_eip:
    region:                     "{{ region }}"
    state:                      "present"
  register: ec2_eip

- name:                         Create NAT Gateway
  ec2_vpc_nat_gateway:
    state:                      "present"
    if_exist_do_not_create:     "true"
    allocation_id:              "{{ ec2_eip.allocation_id }}"
    region:                     "{{ region }}"
    

Thanks in  Advance

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a6f97987-f681-475b-b90f-0bc68ebc3140%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to