mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
azure_rm_virtualmachine: add custom image support (#32367)
* azure_rm_virtualmachine: added support for specifying custom image * Use separate parameter for custom_image, add very basic test * missed the version_added tag for doco * removed whitespace I accidentally left in * merged custom image into the image dict and added more tests * added one more test
This commit is contained in:
parent
85f727ad4b
commit
abc4210a33
2 changed files with 132 additions and 28 deletions
|
@ -155,3 +155,44 @@
|
|||
|
||||
- assert:
|
||||
that: azure_publicipaddresses | length == 0
|
||||
|
||||
# TODO: Until we have a module to create/delete images this is the best tests
|
||||
# I can do
|
||||
- name: assert error thrown with invalid image dict
|
||||
azure_rm_virtualmachine:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: testvm002
|
||||
state: present
|
||||
image:
|
||||
offer: UbuntuServer
|
||||
register: fail_invalid_image_dict
|
||||
failed_when: 'fail_invalid_image_dict.msg != "parameter error: expecting image to contain [publisher, offer, sku, version] or [name, resource_group]"'
|
||||
|
||||
- name: assert error thrown with invalid image type
|
||||
azure_rm_virtualmachine:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: testvm002
|
||||
state: present
|
||||
image:
|
||||
- testing
|
||||
register: fail_invalid_image_type
|
||||
failed_when: 'fail_invalid_image_type.msg != "parameter error: expecting image to be a string or dict not list"'
|
||||
|
||||
- name: assert error finding missing custom image
|
||||
azure_rm_virtualmachine:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: testvm002
|
||||
state: present
|
||||
image: invalid-image
|
||||
register: fail_missing_custom_image
|
||||
failed_when: fail_missing_custom_image.msg != "Error could not find image with name invalid-image"
|
||||
|
||||
- name: assert error finding missing custom image (dict style)
|
||||
azure_rm_virtualmachine:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: testvm002
|
||||
state: present
|
||||
image:
|
||||
name: invalid-image
|
||||
register: fail_missing_custom_image_dict
|
||||
failed_when: fail_missing_custom_image_dict.msg != "Error could not find image with name invalid-image"
|
Loading…
Add table
Add a link
Reference in a new issue