Ansible repository with playbooks to manage azure objects
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

35 linhas
1.4 KiB

  1. ---
  2. - name: Build tags list
  3. set_fact:
  4. tags_list: "{{ tags_list | default([]) | 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_info:
  10. ad_user: "{{ azure_ad_user | default(omit) }}"
  11. password: "{{ azure_password | default(omit) }}"
  12. subscription_id: "{{ azure_subscription_id | default(lookup('env', 'AZURE_SUBSCRIPTION_ID')) }}"
  13. client_id: "{{ azure_client_id | default(lookup('env', 'AZURE_CLIENT_ID')) }}"
  14. secret: "{{ azure_secret | default(lookup('env', 'AZURE_SECRET')) }}"
  15. tenant: "{{ azure_tenant | default(lookup('env', 'AZURE_TENANT')) }}"
  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(lookup('env', 'AZURE_SUBSCRIPTION_ID')) }}"
  25. client_id: "{{ azure_client_id | default(lookup('env', 'AZURE_CLIENT_ID')) }}"
  26. secret: "{{ azure_secret | default(lookup('env', 'AZURE_SECRET')) }}"
  27. tenant: "{{ azure_tenant | default(lookup('env', 'AZURE_TENANT')) }}"
  28. name: "{{ ip.name }}"
  29. resource_group: "{{ ip.resource_group }}"
  30. state: "absent"
  31. register: deletedip
  32. ...