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.
 
 
 

48 lines
1.9 KiB

  1. ---
  2. - set_fact:
  3. tags_list: "{{ tags_list | default([]) |
  4. union([[tag.key,tag.value]|join(':')]) }}"
  5. loop: "{{ lookup('dict', disk.tags | default({}, true)) }}"
  6. loop_control:
  7. loop_var: "tag"
  8. - name: Get disk
  9. azure_rm_manageddisk_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: "{{ disk.resource_group }}"
  17. tags: "{{ tags_list | default(omit) }}"
  18. name: "{{ disk.name | default(omit) }}"
  19. register: azure_disk_facts
  20. failed_when: false
  21. - name: Create disk
  22. azure_rm_manageddisk:
  23. ad_user: "{{ azure_ad_user | default(omit) }}"
  24. password: "{{ azure_password | default(omit) }}"
  25. subscription_id: "{{ azure_subscription_id | default(omit) }}"
  26. client_id: "{{ azure_client_id | default(omit) }}"
  27. secret: "{{ azure_secret | default(omit) }}"
  28. tenant: "{{ azure_tenant | default(omit) }}"
  29. name: "{{ disk.name }}"
  30. location: "{{ disk.location | default(omit, true) }}"
  31. resource_group: "{{ disk.resource_group }}"
  32. zones: "{{ disk.zone | default(omit, true) }}"
  33. disk_size_gb: "{{ disk.disk_size_gb | default('30', true) }}"
  34. state: "present"
  35. attach_caching: "{{ disk.attach_caching | default('read_only', true) }}"
  36. create_option: "{{ disk.create_option | default('empty', true) }}"
  37. source_uri: "{{ disk.source_uri | default(omit, true) }}"
  38. managed_by: "{{ disk.managed_by | default('', true) }}"
  39. os_type: "{{ disk.os_type | default(omit, true) }}"
  40. storage_account_type: "{{ disk.storage_account_type | default('StandardSSD_LRS', true) }}"
  41. tags: "{{ disk.tags | default(omit, true) }}"
  42. append_tags: false
  43. register: createdisk
  44. ...
  45. ...