Ansible repository with playbooks to manage azure objects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
1.2 KiB

  1. ---
  2. - set_fact:
  3. tags_list: "{{ tags_list | default([]) |
  4. union([[tag.key,tag.value]|join(':')]) }}"
  5. loop: "{{ lookup('dict', ip.tags | default({})) }}"
  6. loop_control:
  7. loop_var: "tag"
  8. - name: Get ip address
  9. azure_rm_publicipaddress_facts:
  10. ad_user: "{{ azure_ad_user | default(omit) }}"
  11. password: "{{ azure_password | default(omit) }}"
  12. subscription_id: "{{ azure_subscription_id | default(omit) }}"
  13. client_id: "{{ azure_client_id | default(omit) }}"
  14. secret: "{{ azure_secret | default(omit) }}"
  15. tenant: "{{ azure_tenant | default(omit) }}"
  16. resource_group: "{{ ip.resource_group }}"
  17. tags: "{{ tags_list | default(omit) }}"
  18. name: "{{ ip.name | default(omit) }}"
  19. register: azure_ip_facts
  20. - name: Delete ip address
  21. azure_rm_publicipaddress:
  22. ad_user: "{{ azure_ad_user | default(omit) }}"
  23. password: "{{ azure_password | default(omit) }}"
  24. subscription_id: "{{ azure_subscription_id | default(omit) }}"
  25. client_id: "{{ azure_client_id | default(omit) }}"
  26. secret: "{{ azure_secret | default(omit) }}"
  27. tenant: "{{ azure_tenant | default(omit) }}"
  28. name: "{{ ip.name }}"
  29. resource_group: "{{ ip.resource_group }}"
  30. state: "absent"
  31. register: deletedip
  32. ...