forked from vmware-archive/nsxansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_vmmigrate.yml
45 lines (42 loc) · 1.26 KB
/
test_vmmigrate.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
34
35
36
37
38
39
40
41
42
43
44
45
---
- hosts: localhost
connection: local
gather_facts: False
vars_files:
- answerfile_TPM_Lab.yml
tasks:
- name: Gather vCenter MOIDs PG
vcenter_gather_moids:
hostname: 'vc01.yves.local'
username: '[email protected]'
password: 'VMware1!'
datacenter_name: 'tpm-lab'
portgroup_name: vlan41
validate_certs: False
register: gather_moid_pg
- name: Gather vCenter UUID VM
vcenter_gather_moids:
hostname: 'vc01.yves.local'
username: '[email protected]'
password: 'VMware1!'
datacenter_name: 'tpm-lab'
virtualmachine_name: test-rhel72-lcp
validate_certs: False
register: gather_uuid_vm
- debug: msg="The searched VM uuid is {{ gather_uuid_vm.object_uuid }}"
- debug: msg="The searched PG moid is {{ gather_moid_pg.object_id }}"
- hosts: localhost
connection: local
gather_facts: False
vars_files:
- answerfile_TPM_Lab.yml
tasks:
- name: vm switch migrate
nsx_attach_vm_switch:
nsxmanager_spec: "{{ nsxmanager_spec }}"
state: present
object_moid: "{{ gather_uuid_vm.object_uuid }}"
logicalswitch: test_ls
# portgroup_id: "{{ gather_moid_pg.object_id }}"
register: create_logical_switch
- debug: var=create_logical_switch