forked from shawarby/Inj-AE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_uuid.yml
33 lines (33 loc) · 1.15 KB
/
get_uuid.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
- hosts: all
gather_facts: yes
tasks:
- name: Getting VMWARE UUID
vmware_guest_info:
validate_certs: no
hostname: "{{ lookup('env','VMWARE_HOST') }}"
username: "{{ lookup('env','VMWARE_USER') }}"
password: "{{ lookup('env','VMWARE_PASSWORD') }}"
validate_certs: no
datacenter: datacenter
name: "{{vm_name}}"
schema: "vsphere"
properties:
register: vminfo
delegate_to: localhost
- name: Rename virtual machine from old name to new name
vmware_guest:
hostname: "{{ lookup('env','VMWARE_HOST') }}"
username: "{{ lookup('env','VMWARE_USER') }}"
password: "{{ lookup('env','VMWARE_PASSWORD') }}"
validate_certs: False
cluster: ClusterA
uuid: "{{ vminfo.instance.config.uuid }}"
name: "{{new_vm_name}}"
- name: Perform storage vMotion of of virtual machine to DS to rename disk
vmware_vmotion:
hostname: "{{ lookup('env','VMWARE_HOST') }}"
username: "{{ lookup('env','VMWARE_USER') }}"
password: "{{ lookup('env','VMWARE_PASSWORD') }}"
validate_certs: no
vm_name: "{{new_vm_name}}"
destination_datastore: '{{datastore}}'