1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

VMware: Update example (#43786)

* Unified examples in all modules
* validate_certs is now 'no' instead of 'False'
* delegate_to changes

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-08-08 17:14:27 +05:30 committed by GitHub
parent 4618583f2f
commit 1366a694f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 516 additions and 529 deletions

View file

@ -79,6 +79,7 @@ EXAMPLES = r'''
folder_type: vm
state: present
register: vm_folder_creation_result
delegate_to: localhost
- name: Create a datastore folder on given datacenter
vcenter_folder:
@ -90,6 +91,7 @@ EXAMPLES = r'''
folder_type: datastore
state: present
register: datastore_folder_creation_result
delegate_to: localhost
- name: Create a sub folder under VM folder on given datacenter
vcenter_folder:
@ -101,6 +103,7 @@ EXAMPLES = r'''
parent_folder: vm_folder
state: present
register: sub_folder_creation_result
delegate_to: localhost
- name: Delete a VM folder on given datacenter
vcenter_folder:
@ -112,6 +115,7 @@ EXAMPLES = r'''
folder_type: vm
state: absent
register: vm_folder_deletion_result
delegate_to: localhost
'''
RETURN = r'''

View file

@ -44,7 +44,7 @@ EXAMPLES = r'''
vmware_about_facts:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxu_password }}'
password: '{{ esxi_password }}'
delegate_to: localhost
register: esxi_about_info
'''

View file

@ -39,17 +39,17 @@ extends_documentation_fragment: vmware_rest_client.documentation
EXAMPLES = r'''
- name: Gather facts about tag categories
vmware_category_facts:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: all_tag_category_facts
- name: Gather category id from given tag category
vmware_category_facts:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
delegate_to: localhost
register: tag_category_results

View file

@ -51,23 +51,21 @@ extends_documentation_fragment: vmware.documentation
'''
EXAMPLES = '''
# save the ESXi configuration locally by authenticating directly against the ESXi host
- name: ESXI backup test
- name: Save the ESXi configuration locally by authenticating directly against the ESXi host
vmware_cfg_backup:
hostname: esxi_hostname
username: user
password: pass
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
state: saved
dest: /tmp/
delegate_to: localhost
# save the ESXi configuration locally by authenticating against the vCenter and selecting the ESXi host
- name: ESXI backup test
- name: Save the ESXi configuration locally by authenticating against the vCenter and selecting the ESXi host
vmware_cfg_backup:
hostname: vCenter
esxi_hostname: esxi_hostname
username: user
password: pass
hostname: '{{ vcenter_hostname }}'
esxi_hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
state: saved
dest: /tmp/
delegate_to: localhost

View file

@ -58,9 +58,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Create Cluster
vmware_cluster:
hostname: '{{ ansible_ssh_host }}'
username: root
password: vmware
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter
cluster_name: cluster
enable_ha: yes

View file

@ -46,21 +46,20 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Gather cluster facts from given datacenter
vmware_cluster_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: ha-datacenter
validate_certs: False
validate_certs: no
delegate_to: localhost
register: cluster_facts
- name: Gather facts from datacenter about specific cluster
vmware_cluster_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: DC0_C0
validate_certs: False
delegate_to: localhost
register: cluster_facts
'''

View file

@ -45,19 +45,19 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Create Datacenter
vmware_datacenter:
hostname: "{{ ansible_ssh_host }}"
username: root
password: vmware
datacenter_name: "datacenter"
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
state: present
delegate_to: localhost
- name: Delete Datacenter
vmware_datacenter:
hostname: vcenter_hostname
username: root
password: pass
datacenter_name: DC2
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
state: absent
delegate_to: localhost
register: datacenter_delete_result

View file

@ -50,22 +50,22 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Create datastore cluster
vmware_datastore_cluster:
hostname: vCenter
username: root
password: vmware
datacenter_name: "datacenter"
datastore_cluster_name: datacluster0
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
datastore_cluster_name: '{{ datastore_cluster_name }}'
state: present
delegate_to: localhost
- name: Delete datastore cluster
vmware_datastore_cluster:
hostname: vCenter
username: root
password: vmware
datacenter_name: "datacenter"
datastore_cluster_name: datacluster0
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter_name }}'
datastore_cluster_name: '{{ datastore_cluster_name }}'
state: absent
delegate_to: localhost
'''

View file

@ -52,22 +52,21 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Gather facts from standalone ESXi server having datacenter as 'ha-datacenter'
vmware_datastore_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
datacenter: ha-datacenter
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter_name }}'
validate_certs: no
delegate_to: localhost
register: facts
- name: Gather facts from datacenter about specific datastore
vmware_datastore_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
datacenter: DC0
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter_name }}'
name: datastore1
validate_certs: no
delegate_to: localhost
register: facts
'''

View file

@ -58,37 +58,37 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Enter datastore into Maintenance Mode
vmware_datastore_maintenancemode:
hostname: vc_host
username: vc_user
password: vc_pass
datastore: datastore1
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datastore: '{{ datastore_name }}'
state: present
delegate_to: localhost
- name: Enter all datastores under cluster into Maintenance Mode
vmware_datastore_maintenancemode:
hostname: vc_host
username: vc_user
password: vc_pass
cluster_name: DC0_C0
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
state: present
delegate_to: localhost
- name: Enter all datastores under datastore cluster into Maintenance Mode
vmware_datastore_maintenancemode:
hostname: vc_host
username: vc_user
password: vc_pass
datastore_cluster: DSC_POD0
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datastore_cluster: '{{ datastore_cluster_name }}'
state: present
delegate_to: localhost
- name: Exit datastore into Maintenance Mode
vmware_datastore_maintenancemode:
hostname: vc_host
username: vc_user
password: vc_pass
datastore: datastore1
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datastore: '{{ datastore_name }}'
state: absent
delegate_to: localhost
'''

View file

@ -107,9 +107,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- vmware_deploy_ovf:
hostname: esx.example.org
username: root
password: passw0rd
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
ovf: /path/to/ubuntu-16.04-amd64.ovf
wait_for_ip_address: true
delegate_to: localhost
@ -118,7 +118,7 @@ EXAMPLES = r'''
RETURN = r'''
instance:
description: metadata about the new virtualmachine
description: metadata about the new virtual machine
returned: always
type: dict
sample: None

View file

@ -44,9 +44,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Configure ESXi hostname and DNS servers
vmware_dns_config:
hostname: esxi_hostname
username: root
password: your_password
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
change_hostname_to: esx01
domainname: foo.org
dns_servers:

View file

@ -48,7 +48,7 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: cluster_drs_facts
@ -57,7 +57,7 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: datacenter_name
datacenter: '{{ datacenter_name }}'
delegate_to: localhost
register: datacenter_drs_facts
'''

View file

@ -55,10 +55,10 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Add Host to dVS
vmware_dvs_host:
hostname: vcenter_ip_or_hostname
username: vcenter_username
password: vcenter_password
esxi_hostname: esxi_hostname_as_listed_in_vcenter
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
switch_name: dvSwitch
vmnics:
- vmnic0

View file

@ -139,78 +139,74 @@ extends_documentation_fragment: vmware.documentation
'''
EXAMPLES = '''
- name: Create vlan portgroup
connection: local
vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname
username: vcenter_username
password: vcenter_password
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create vlan portgroup
vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create vlan trunk portgroup
connection: local
vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname
username: vcenter_username
password: vcenter_password
portgroup_name: vlan-trunk-portrgoup
switch_name: dvSwitch
vlan_id: 1-1000
vlan_trunk: True
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create vlan trunk portgroup
vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-trunk-portrgoup
switch_name: dvSwitch
vlan_id: 1-1000
vlan_trunk: True
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create no-vlan portgroup
connection: local
vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname
username: vcenter_username
password: vcenter_password
portgroup_name: no-vlan-portrgoup
switch_name: dvSwitch
vlan_id: 0
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create no-vlan portgroup
vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: no-vlan-portrgoup
switch_name: dvSwitch
vlan_id: 0
num_ports: 120
portgroup_type: earlyBinding
state: present
delegate_to: localhost
- name: Create vlan portgroup with all security and port policies
connection: local
vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname
username: vcenter_username
password: vcenter_password
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
portgroup_type: earlyBinding
state: present
network_policy:
promiscuous: yes
forged_transmits: yes
mac_changes: yes
port_policy:
block_override: yes
ipfix_override: yes
live_port_move: yes
network_rp_override: yes
port_config_reset_at_disconnect: yes
security_override: yes
shaping_override: yes
traffic_filter_override: yes
uplink_teaming_override: yes
vendor_config_override: yes
vlan_override: yes
delegate_to: localhost
- name: Create vlan portgroup with all security and port policies
vmware_dvs_portgroup:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch
vlan_id: 123
num_ports: 120
portgroup_type: earlyBinding
state: present
network_policy:
promiscuous: yes
forged_transmits: yes
mac_changes: yes
port_policy:
block_override: yes
ipfix_override: yes
live_port_move: yes
network_rp_override: yes
port_config_reset_at_disconnect: yes
security_override: yes
shaping_override: yes
traffic_filter_override: yes
uplink_teaming_override: yes
vendor_config_override: yes
vlan_override: yes
delegate_to: localhost
'''
try:

View file

@ -76,9 +76,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Create dvswitch
vmware_dvswitch:
hostname: vcenter_ip_or_hostname
username: vcenter_username
password: vcenter_password
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: datacenter
switch_name: dvSwitch
switch_version: 6.0.0

View file

@ -331,10 +331,10 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Create a virtual machine on given ESXi hostname
vmware_guest:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
validate_certs: no
folder: /DC1/vm/
name: test_vm_0001
state: poweredon
@ -361,10 +361,10 @@ EXAMPLES = r'''
- name: Create a virtual machine from a template
vmware_guest:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
validate_certs: no
folder: /testvms
name: testvm_2
state: poweredon
@ -402,10 +402,10 @@ EXAMPLES = r'''
- name: Clone a virtual machine from Windows template and customize
vmware_guest:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
validate_certs: no
datacenter: datacenter1
cluster: cluster
name: testvm-2
@ -435,8 +435,8 @@ EXAMPLES = r'''
- name: Clone a virtual machine from Linux template and customize
vmware_guest:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
datacenter: "{{ datacenter }}"
@ -462,10 +462,10 @@ EXAMPLES = r'''
- name: Rename a virtual machine (requires the virtual machine's uuid)
vmware_guest:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
validate_certs: no
uuid: "{{ vm_uuid }}"
name: new_name
state: present
@ -473,20 +473,20 @@ EXAMPLES = r'''
- name: Remove a virtual machine by uuid
vmware_guest:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
validate_certs: no
uuid: "{{ vm_uuid }}"
state: absent
delegate_to: localhost
- name: Manipulate vApp properties
vmware_guest:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
validate_certs: no
name: vm_name
state: present
vapp_properties:
@ -501,10 +501,10 @@ EXAMPLES = r'''
- name: Set powerstate of a virtual machine to poweroff by using UUID
vmware_guest:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
validate_certs: no
uuid: "{{ vm_uuid }}"
state: poweredoff
delegate_to: localhost

View file

@ -78,9 +78,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Change virtual machine's boot order and related parameters
vmware_guest_boot_manager:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: testvm
boot_delay: 2000
enter_bios_setup: True

View file

@ -52,7 +52,7 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Add VMWare Attribute Definition
vmware_guest_custom_attribute_defs:
hostname: "{{ vcenter_server }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
state: present
@ -62,7 +62,7 @@ EXAMPLES = '''
- name: Remove VMWare Attribute Definition
vmware_guest_custom_attribute_defs:
hostname: "{{ vcenter_server }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
state: absent

View file

@ -67,9 +67,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Add virtual machine custom attributes
vmware_guest_custom_attributes:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
state: present
attributes:
@ -80,9 +80,9 @@ EXAMPLES = '''
- name: Add multiple virtual machine custom attributes
vmware_guest_custom_attributes:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
state: present
attributes:
@ -95,9 +95,9 @@ EXAMPLES = '''
- name: Remove virtual machine Attribute
vmware_guest_custom_attributes:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: 421e4592-c069-924d-ce20-7e7533fab926
state: absent
attributes:

View file

@ -65,9 +65,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Gather disk facts from virtual machine using UUID
vmware_guest_disk_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: ha-datacenter
validate_certs: no
uuid: 421e4592-c069-924d-ce20-7e7533fab926
@ -76,9 +76,9 @@ EXAMPLES = '''
- name: Gather disk facts from virtual machine using name
vmware_guest_disk_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: ha-datacenter
validate_certs: no
name: VM_225
@ -126,7 +126,7 @@ class PyVmomiHelper(PyVmomi):
def gather_disk_facts(self, vm_obj):
"""
Function to gather facts about VM's disks
Gather facts about VM's disks
Args:
vm_obj: Managed object of virtual machine

View file

@ -69,9 +69,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Gather facts from standalone ESXi server having datacenter as 'ha-datacenter'
vmware_guest_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: ha-datacenter
validate_certs: no
uuid: 421e4592-c069-924d-ce20-7e7533fab926

View file

@ -107,14 +107,14 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Create directory inside a vm
vmware_guest_file_operation:
hostname: myVSphere
username: myUsername
password: mySecret
datacenter: myDatacenter
validate_certs: True
vm_id: NameOfVM
vm_username: root
vm_password: superSecret
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
validate_certs: no
vm_id: "{{ guest_name }}"
vm_username: "{{ guest_username }}"
vm_password: "{{ guest_userpassword }}"
directory:
path: "/test"
operation: create
@ -123,14 +123,13 @@ EXAMPLES = '''
- name: copy file to vm
vmware_guest_file_operation:
hostname: myVSphere
username: myUsername
password: mySecret
datacenter: myDatacenter
validate_certs: True
vm_id: NameOfVM
vm_username: root
vm_password: superSecret
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
vm_id: "{{ guest_name }}"
vm_username: "{{ guest_username }}"
vm_password: "{{ guest_userpassword }}"
copy:
src: "files/test.zip"
dest: "/root/test.zip"
@ -139,14 +138,13 @@ EXAMPLES = '''
- name: fetch file from vm
vmware_guest_file_operation:
hostname: myVSphere
username: myUsername
password: mySecret
datacenter: myDatacenter
validate_certs: True
vm_id: NameOfVM
vm_username: root
vm_password: superSecret
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
vm_id: "{{ guest_name }}"
vm_username: "{{ guest_username }}"
vm_password: "{{ guest_userpassword }}"
fetch:
src: "/root/test.zip"
dest: "files/test.zip"

View file

@ -46,9 +46,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Find Guest's Folder using name
vmware_guest_find:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
name: testvm
delegate_to: localhost
@ -56,10 +56,9 @@ EXAMPLES = r'''
- name: Find Guest's Folder using UUID
vmware_guest_find:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
validate_certs: no
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
uuid: 38c4c89c-b3d7-4ae6-ae4e-43c5118eae49
delegate_to: localhost
register: vm_folder

View file

@ -68,30 +68,30 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Move Virtual Machine
vmware_guest_move:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: datacenter
validate_certs: False
validate_certs: no
name: testvm-1
dest_folder: datacenter/vm/prodvms
dest_folder: /"{{ datacenter }}"/vm
delegate_to: localhost
- name: Get VM UUID
vmware_guest_facts:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
folder: /"{{datacenter}}"/vm
name: "{{ vm_name }}"
delegate_to: localhost
register: vm_facts
- name: Get UUID from previous task and pass it to this task
vmware_guest_move:
hostname: "{{ vcenter_ip }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no

View file

@ -84,24 +84,23 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Set the state of a virtual machine to poweroff
vmware_guest_powerstate:
hostname: 192.0.2.44
username: administrator@vsphere.local
password: vmware
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
folder: /testvms
name: testvm_2
folder: /"{{ datacenter_name }}"/vm/my_folder
name: "{{ guest_name }}"
state: powered-off
delegate_to: localhost
register: deploy
- name: Set the state of a virtual machine to poweroff at given scheduled time
vmware_guest_powerstate:
hostname: 192.0.2.44
username: administrator@vsphere.local
password: vmware
validate_certs: no
folder: /datacenter-1/vm/my_folder
name: testvm_2
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
folder: /"{{ datacenter_name }}"/vm/my_folder
name: "{{ guest_name }}"
state: powered-off
scheduled_at: "09/01/2018 10:18"
delegate_to: localhost
@ -109,11 +108,10 @@ EXAMPLES = r'''
- name: Wait for the virtual machine to shutdown
vmware_guest_powerstate:
hostname: 192.0.2.44
username: administrator@vsphere.local
password: vmware
validate_certs: no
name: testvm_2
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ guest_name }}"
state: shutdown-guest
state_change_timeout: 200
delegate_to: localhost

View file

@ -123,12 +123,12 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Create a snapshot
vmware_guest_snapshot:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
datacenter: datacenter_name
folder: /myfolder
name: dummy_vm
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: /"{{ datacenter_name }}"/vm/
name: "{{ guest_name }}"
state: present
snapshot_name: snap1
description: snap1_description
@ -136,72 +136,78 @@ EXAMPLES = '''
- name: Remove a snapshot
vmware_guest_snapshot:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
name: dummy_vm
datacenter: datacenter_name
folder: /myfolder
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: /"{{ datacenter_name }}"/vm/
name: "{{ guest_name }}"
state: absent
snapshot_name: snap1
delegate_to: localhost
- name: Revert to a snapshot
vmware_guest_snapshot:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
datacenter: datacenter_name
folder: /myfolder
name: dummy_vm
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: /"{{ datacenter_name }}"/vm/
name: "{{ guest_name }}"
state: revert
snapshot_name: snap1
delegate_to: localhost
- name: Remove all snapshots of a VM
vmware_guest_snapshot:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
datacenter: datacenter_name
folder: /myfolder
name: dummy_vm
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: /"{{ datacenter_name }}"/vm/
name: "{{ guest_name }}"
state: remove_all
delegate_to: localhost
- name: Take snapshot of a VM using quiesce and memory flag on
vmware_guest_snapshot:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
name: dummy_vm
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: /"{{ datacenter_name }}"/vm/
name: "{{ guest_name }}"
state: present
snapshot_name: dummy_vm_snap_0001
quiesce: True
memory_dump: True
quiesce: yes
memory_dump: yes
delegate_to: localhost
- name: Remove a snapshot and snapshot subtree
vmware_guest_snapshot:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
name: dummy_vm
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: /"{{ datacenter_name }}"/vm/
name: "{{ guest_name }}"
state: absent
remove_children: True
remove_children: yes
snapshot_name: snap1
delegate_to: localhost
- name: Rename a snapshot
vmware_guest_snapshot:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
name: dummy_vm
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: /"{{ datacenter_name }}"/vm/
name: "{{ guest_name }}"
state: present
snapshot_name: current_snap_name
new_snapshot_name: im_renamed
new_description: "renamed snapshot today"
new_description: "{{ new_snapshot_description }}"
delegate_to: localhost
'''

View file

@ -61,13 +61,13 @@ extends_documentation_fragment: vmware.documentation
'''
EXAMPLES = '''
- name: Gather facts about the virtual machine in given vCenter
- name: Gather snapshot facts about the virtual machine in the given vCenter
vmware_guest_snapshot_facts:
hostname: 192.168.1.209
username: administrator@vsphere.local
password: vmware
datacenter: datacenter_name
name: dummy_vm
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: "{{ guest_name }}"
delegate_to: localhost
register: snapshot_facts
'''

View file

@ -62,21 +62,21 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Wait for VMware tools to become available by UUID
vmware_guest_facts:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
datacenter: "{{ datacenter }}"
folder: "/{{datacenter}}/vm"
folder: /"{{datacenter}}"/vm
name: "{{ vm_name }}"
delegate_to: localhost
register: vm_facts
- name: Get UUID from previous task and pass it to this task
vmware_guest_tools_wait:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
uuid: "{{ vm_facts.instance.hw_product_uuid }}"
delegate_to: localhost
@ -85,12 +85,12 @@ EXAMPLES = '''
- name: Wait for VMware tools to become available by name
vmware_guest_tools_wait:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
name: test-vm
folder: "/{{datacenter}}/vm"
folder: /"{{datacenter}}"/vm
delegate_to: localhost
register: facts
'''

View file

@ -83,8 +83,8 @@ EXAMPLES = r'''
- name: Mount VMFS datastores to ESXi
vmware_host_datastore:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_user }}'
password: '{{ vcenter_pass }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter }}'
datastore_name: '{{ item.name }}'
datastore_type: '{{ item.type }}'
@ -97,8 +97,8 @@ EXAMPLES = r'''
- name: Mount NFS datastores to ESXi
vmware_host_datastore:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_user }}'
password: '{{ vcenter_pass }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter }}'
datastore_name: '{{ item.name }}'
datastore_type: '{{ item.type }}'
@ -115,8 +115,8 @@ EXAMPLES = r'''
- name: Remove/Umount Datastores from ESXi
vmware_host_datastore:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_user }}'
password: '{{ vcenter_pass }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter }}'
datastore_name: NasDS_vol01
esxi_hostname: '{{ inventory_hostname }}'

View file

@ -36,19 +36,18 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Gather vmware host facts
vmware_host_facts:
hostname: esxi_ip_or_hostname
username: username
password: password
hostname: "{{ esxi_server }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
register: host_facts
delegate_to: localhost
- name: Get VSAN Cluster UUID from host facts
vmware_host_facts:
hostname: esxi_ip_or_hostname
username: username
password: password
hostname: "{{ esxi_server }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
register: host_facts
- set_fact:
cluster_uuid: "{{ host_facts['ansible_facts']['vsan_cluster_uuid'] }}"
'''

View file

@ -66,33 +66,33 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Set the state of a host system to reboot
vmware_host_powerstate:
hostname: 192.0.2.44
username: administrator@vsphere.local
password: vmware
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
esxi_hostname: esxi01
esxi_hostname: '{{ esxi_hostname }}'
state: reboot-host
delegate_to: localhost
register: reboot_host
- name: Set the state of a host system to power down to standby
vmware_host_powerstate:
hostname: 192.0.2.44
username: administrator@vsphere.local
password: vmware
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
esxi_hostname: power-down-to-standby
esxi_hostname: '{{ esxi_hostname }}'
state: power-down-to-standby
delegate_to: localhost
register: power_down
- name: Set the state of all host systems from cluster to reboot
vmware_host_powerstate:
hostname: 192.0.2.44
username: administrator@vsphere.local
password: vmware
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
cluster_name: DC0_C0
cluster_name: '{{ cluster_name }}'
state: reboot-host
delegate_to: localhost
register: reboot_host

View file

@ -68,7 +68,7 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
cluster_name: '{{ cluster_name }}'
service_name: ntpd
state: present
delegate_to: localhost

View file

@ -51,7 +51,7 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: cluster_host_vmnics

View file

@ -58,30 +58,30 @@ EXAMPLES = '''
# Example vmware_local_role_manager command from Ansible Playbooks
- name: Add local role to ESXi
vmware_local_role_manager:
hostname: esxi_hostname
username: root
password: vmware
local_role_name: vmware_qa
state: present
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
local_role_name: vmware_qa
state: present
delegate_to: localhost
- name: Add local role with privileges to ESXi
vmware_local_role_manager:
hostname: esxi_hostname
username: root
password: vmware
local_role_name: vmware_qa
local_privilege_ids: [ 'Folder.Create', 'Folder.Delete']
state: present
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
local_role_name: vmware_qa
local_privilege_ids: [ 'Folder.Create', 'Folder.Delete']
state: present
delegate_to: localhost
- name: Remove local role from ESXi
vmware_local_role_manager:
hostname: esxi_hostname
username: root
password: vmware
local_role_name: vmware_qa
state: absent
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
local_role_name: vmware_qa
state: absent
delegate_to: localhost
'''

View file

@ -36,9 +36,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Gather facts about all Users on given ESXi host system
vmware_local_user_facts:
hostname: esxi_hostname
username: root
password: vmware
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
delegate_to: localhost
register: all_user_facts
'''

View file

@ -70,10 +70,10 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Enter VSAN-Compliant Maintenance Mode
vmware_maintenancemode:
hostname: vc_host
username: vc_user
password: vc_pass
esxi_hostname: esxi.host.example
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
vsan: ensureObjectAccessibility
evacuate: yes
timeout: 3600

View file

@ -57,10 +57,10 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Migrate Management vmk
vmware_migrate_vmk:
hostname: vcsa_host
username: vcsa_user
password: vcsa_pass
esxi_hostname: esxi_hostname
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
esxi_hostname: "{{ esxi_hostname }}"
device: vmk1
current_switch_name: temp_vswitch
current_portgroup_name: esx-mgmt

View file

@ -104,66 +104,66 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Add Management Network VM Portgroup
vmware_portgroup:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
hostname: "{{ esxi_hostname }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
switch_name: "{{ vswitch_name }}"
portgroup_name: "{{ portgroup_name }}"
vlan_id: "{{ vlan_id }}"
delegate_to: localhost
- name: Add Portgroup with Promiscuous Mode Enabled
vmware_portgroup:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
switch_name: vswitch_name
portgroup_name: portgroup_name
hostname: "{{ esxi_hostname }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
switch_name: "{{ vswitch_name }}"
portgroup_name: "{{ portgroup_name }}"
network_policy:
promiscuous_mode: True
delegate_to: localhost
- name: Add Management Network VM Portgroup to specific hosts
vmware_portgroup:
hostname: vCenter_hostname
username: esxi_username
password: esxi_password
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
hosts: [esxi_hostname_one]
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
switch_name: "{{ vswitch_name }}"
portgroup_name: "{{ portgroup_name }}"
vlan_id: "{{ vlan_id }}"
delegate_to: localhost
- name: Add Management Network VM Portgroup to all hosts in a cluster
vmware_portgroup:
hostname: vCenter_hostname
username: esxi_username
password: esxi_password
cluster_name: rh_engineering
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
cluster_name: "{{ cluster_name }}"
switch_name: "{{ vswitch_name }}"
portgroup_name: "{{ portgroup_name }}"
vlan_id: "{{ vlan_id }}"
delegate_to: localhost
- name: Remove Management Network VM Portgroup to all hosts in a cluster
vmware_portgroup:
hostname: vCenter_hostname
username: esxi_username
password: esxi_password
cluster_name: rh_engineering
switch_name: vswitch_name
portgroup_name: portgroup_name
vlan_id: vlan_id
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
cluster_name: "{{ cluster_name }}"
switch_name: "{{ vswitch_name }}"
portgroup_name: "{{ portgroup_name }}"
vlan_id: "{{ vlan_id }}"
state: absent
delegate_to: localhost
- name: Add Portgroup with teaming policy
vmware_portgroup:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
switch_name: vswitch_name
portgroup_name: portgroup_name
hostname: "{{ esxi_hostname }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
switch_name: "{{ vswitch_name }}"
portgroup_name: "{{ portgroup_name }}"
teaming_policy:
load_balance_policy: 'failover_explicit'
inbound_policy: True

View file

@ -46,7 +46,7 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
- name: Gather portgroup facts about ESXi Host system

View file

@ -95,25 +95,24 @@ extends_documentation_fragment: vmware.documentation
'''
EXAMPLES = '''
# Create a resource pool
- name: Add resource pool to vCenter
vmware_resource_pool:
hostname: vcsa_host
username: vcsa_user
password: vcsa_pass
datacenter: datacenter
cluster: cluster
resource_pool: resource_pool
mem_shares: normal
mem_limit: -1
mem_reservation: 0
mem_expandable_reservations: True
cpu_shares: normal
cpu_limit: -1
cpu_reservation: 0
cpu_expandable_reservations: True
state: present
delegate_to: localhost
- name: Add resource pool to vCenter
vmware_resource_pool:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ datacenter_name }}'
cluster: '{{ cluster_name }}'
resource_pool: '{{ resource_pool_name }}'
mem_shares: normal
mem_limit: -1
mem_reservation: 0
mem_expandable_reservations: yes
cpu_shares: normal
cpu_limit: -1
cpu_reservation: 0
cpu_expandable_reservations: yes
state: present
delegate_to: localhost
'''
RETURN = """

View file

@ -65,10 +65,10 @@ extends_documentation_fragment: vmware_rest_client.documentation
EXAMPLES = r'''
- name: Create a tag
vmware_tag:
hostname: 10.65.223.91
username: administrator@vsphere.local
password: Esxi@123$
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
category_id: 'urn:vmomi:InventoryServiceCategory:e785088d-6981-4b1c-9fb8-1100c3e1f742:GLOBAL'
tag_name: Sample_Tag_0002
tag_description: Sample Description
@ -77,10 +77,9 @@ EXAMPLES = r'''
- name: Update tag description
vmware_tag:
hostname: 10.65.223.91
username: administrator@vsphere.local
password: Esxi@123$
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
tag_name: Sample_Tag_0002
tag_description: Some fancy description
state: present
@ -88,10 +87,9 @@ EXAMPLES = r'''
- name: Delete tag
vmware_tag:
hostname: 10.65.223.91
username: administrator@vsphere.local
password: Esxi@123$
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
tag_name: Sample_Tag_0002
state: absent
delegate_to: localhost

View file

@ -39,21 +39,19 @@ extends_documentation_fragment: vmware_rest_client.documentation
EXAMPLES = r'''
- name: Get facts about tag
vmware_tag_facts:
hostname: 10.65.223.91
username: administrator@vsphere.local
password: Esxi@123$
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
delegate_to: localhost
- name: Get category id from the given tag
vmware_tag_facts:
hostname: 10.65.223.91
username: administrator@vsphere.local
password: Esxi@123$
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
delegate_to: localhost
register: tag_details
- debug:
msg: "{{ tag_details.tag_facts['fedora_machines']['tag_category_id'] }}"

View file

@ -52,27 +52,27 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Get Canonical name of particular target on particular ESXi host system
vmware_target_canonical_facts:
hostname: vcenter_hostname
username: vcenter_user
password: vcenter_pass
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
target_id: 7
esxi_hostname: esxi_hostname
delegate_to: localhost
- name: Get Canonical name of all target on particular ESXi host system
vmware_target_canonical_facts:
hostname: vcenter_hostname
username: vcenter_user
password: vcenter_pass
esxi_hostname: esxi_hostname
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
delegate_to: localhost
- name: Get Canonical name of all ESXi hostname on particular Cluster
vmware_target_canonical_facts:
hostname: vcenter_hostname
username: vcenter_user
password: vcenter_pass
cluster_name: cluster_name
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
'''

View file

@ -45,9 +45,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Gather all registered virtual machines
vmware_vm_facts:
hostname: esxi_or_vcenter_ip_or_hostname
username: username
password: password
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
delegate_to: localhost
register: vmfacts
@ -56,9 +56,9 @@ EXAMPLES = r'''
- name: Gather only registered virtual machine templates
vmware_vm_facts:
hostname: esxi_or_vcenter_ip_or_hostname
username: username
password: password
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_type: template
delegate_to: localhost
register: template_facts
@ -68,9 +68,9 @@ EXAMPLES = r'''
- name: Gather only registered virtual machines
vmware_vm_facts:
hostname: esxi_or_vcenter_ip_or_hostname
username: username
password: password
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_type: vm
delegate_to: localhost
register: vm_facts

View file

@ -105,9 +105,9 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Run command inside a virtual machine
vmware_vm_shell:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: /"{{datacenter}}"/vm
vm_id: "{{ vm_name }}"
@ -124,9 +124,9 @@ EXAMPLES = r'''
- name: Run command inside a virtual machine with wait and timeout
vmware_vm_shell:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: /"{{datacenter}}"/vm
vm_id: NameOfVM
@ -141,9 +141,9 @@ EXAMPLES = r'''
- name: Change user password in the guest machine
vmware_vm_shell:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter }}"
folder: /"{{datacenter}}"/vm
vm_id: "{{ vm_name }}"
@ -155,9 +155,9 @@ EXAMPLES = r'''
- name: Change hostname of guest machine
vmware_vm_shell:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
datacenter: "{{ datacenter }}"
folder: /"{{datacenter}}"/vm

View file

@ -73,7 +73,7 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = r'''
- name: Create DRS Affinity Rule for VM-VM
vmware_vm_vm_drs_rule:
hostname: "{{ esxi }}"
hostname: "{{ esxi_server }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
cluster_name: "{{ cluster_name }}"
@ -89,7 +89,7 @@ EXAMPLES = r'''
- name: Create DRS Anti-Affinity Rule for VM-VM
vmware_vm_vm_drs_rule:
hostname: "{{ esxi }}"
hostname: "{{ esxi_server }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
cluster_name: "{{ cluster_name }}"
@ -105,7 +105,7 @@ EXAMPLES = r'''
- name: Delete DRS Affinity Rule for VM-VM
vmware_vm_vm_drs_rule:
hostname: "{{ esxi }}"
hostname: "{{ esxi_server }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
cluster_name: "{{ cluster_name }}"

View file

@ -40,11 +40,11 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Migrate VCSA to vDS
vmware_vm_vss_dvs_migrate:
hostname: vcenter_ip_or_hostname
username: vcenter_username
password: vcenter_password
vm_name: virtual_machine_name
dvportgroup_name: distributed_portgroup_name
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: '{{ vm_name }}'
dvportgroup_name: '{{ distributed_portgroup_name }}'
delegate_to: localhost
'''

View file

@ -116,12 +116,12 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Add Management vmkernel port using static network type
vmware_vmkernel:
hostname: 192.168.127.9
username: admin
password: supersecret123
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vswitch_name: vSwitch0
portgroup_name: PG_0001
vlan_id: vlan_id
vlan_id: '{{ vlan_id }}'
network:
type: 'static'
ip_address: 192.168.127.10
@ -132,12 +132,12 @@ EXAMPLES = '''
- name: Add Management vmkernel port using DHCP network type
vmware_vmkernel:
hostname: 192.168.127.9
username: admin
password: supersecret123
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vswitch_name: vSwitch0
portgroup_name: PG_0002
vlan_id: vlan_id
vlan_id: '{{ vlan_id }}'
state: present
network:
type: 'dhcp'
@ -146,12 +146,12 @@ EXAMPLES = '''
- name: Delete VMkernel port using DHCP network type
vmware_vmkernel:
hostname: 192.168.127.9
username: admin
password: supersecret123
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vswitch_name: vSwitch0
portgroup_name: PG_0002
vlan_id: vlan_id
vlan_id: '{{ vlan_id }}'
state: absent
delegate_to: localhost
'''

View file

@ -47,9 +47,9 @@ EXAMPLES = '''
- name: Configure IP address on ESX host
vmware_vmkernel_ip_config:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vmk_name: vmk0
ip_address: 10.0.0.10
subnet_mask: 255.255.255.0

View file

@ -63,30 +63,30 @@ extends_documentation_fragment: vmware.documentation
EXAMPLES = '''
- name: Perform vMotion of virtual machine
vmware_vmotion:
hostname: 'vcenter_hostname'
username: 'vcenter_username'
password: 'vcenter_password'
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
vm_name: 'vm_name_as_per_vcenter'
destination_host: 'destination_host_as_per_vcenter'
delegate_to: localhost
- name: Perform storage vMotion of of virtual machine
vmware_vmotion:
hostname: 'vcenter_hostname'
username: 'vcenter_username'
password: 'vcenter_password'
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
vm_name: 'vm_name_as_per_vcenter'
destination_datastore: 'destination_datastore_as_per_vcenter'
delegate_to: localhost
- name: Perform storage vMotion and host vMotion of virtual machine
vmware_vmotion:
hostname: 'vcenter_hostname'
username: 'vcenter_username'
password: 'vcenter_password'
validate_certs: False
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
vm_name: 'vm_name_as_per_vcenter'
destination_host: 'destination_host_as_per_vcenter'
destination_datastore: 'destination_datastore_as_per_vcenter'

View file

@ -34,11 +34,8 @@ extends_documentation_fragment: vmware.documentation
'''
EXAMPLES = '''
# Example command from Ansible Playbook
- name: Configure VMware VSAN Cluster
hosts: deploy_node
gather_facts: False
tags:
- vsan
tasks:

View file

@ -68,11 +68,10 @@ extends_documentation_fragment:
EXAMPLES = '''
- name: Add a VMware vSwitch
action:
module: vmware_vswitch
hostname: esxi_hostname
username: esxi_username
password: esxi_password
vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vswitch_name
nics: vmnic_name
mtu: 9000
@ -80,18 +79,18 @@ EXAMPLES = '''
- name: Add a VMWare vSwitch without any physical NIC attached
vmware_vswitch:
hostname: 192.168.10.1
username: admin
password: password123
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vswitch_0001
mtu: 9000
delegate_to: localhost
- name: Add a VMWare vSwitch with multiple NICs
vmware_vswitch:
hostname: esxi_hostname
username: esxi_username
password: esxi_password
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vmware_vswitch_0004
nics:
- vmnic1
@ -101,9 +100,9 @@ EXAMPLES = '''
- name: Add a VMware vSwitch to a specific host system
vmware_vswitch:
hostname: 192.168.10.1
username: esxi_username
password: esxi_password
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: DC0_H0
switch_name: vswitch_001
nic_name: vmnic0

View file

@ -45,7 +45,7 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: cluster_name
cluster_name: '{{ cluster_name }}'
delegate_to: localhost
register: all_hosts_vswitch_facts

View file

@ -67,9 +67,9 @@ notes:
EXAMPLES = '''
- vsphere_copy:
host: vhost
login: vuser
password: vpass
host: '{{ vhost }}'
login: '{{ vuser }}'
password: '{{ vpass }}'
src: /some/local/file
datacenter: DC1 Someplace
datastore: datastore1
@ -77,9 +77,9 @@ EXAMPLES = '''
delegate_to: localhost
- vsphere_copy:
host: vhost
login: vuser
password: vpass
host: '{{ vhost }}'
login: '{{ vuser }}'
password: '{{ vpass }}'
src: /other/local/file
datacenter: DC2 Someplace
datastore: datastore2