forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 3
1 FAQ: VirtualMachine: generalize VM
Yuwei Zhou edited this page May 13, 2019
·
2 revisions
If user wants to create an image from a VM, the VM should be generalized before the image created. The task should like
- name: Stop and generalize VMs
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: "{{ vm_name }}"
generalized: yes
NOTE: This feature is supported from Ansible v2.8. Ansible v2.7 can use rest module as following, otherwise, install the azure_modules role to support it.
- name: Generalize VM using REST API
azure_rm_resource:
# url: /subscriptions/{{ lookup('env','AZURE_SUBSCRIPTION_ID') }}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize
api_version: '2017-12-01'
method: POST
resource_group: "{{ resource_group }}"
provider: compute
resource_type: virtualmachines
resource_name: "{{ vm_name }}"
subresource:
- type: generalize