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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -139,12 +139,11 @@ extends_documentation_fragment: vmware.documentation
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: Create vlan portgroup - name: Create vlan portgroup
connection: local
vmware_dvs_portgroup: vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname hostname: '{{ vcenter_hostname }}'
username: vcenter_username username: '{{ vcenter_username }}'
password: vcenter_password password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch switch_name: dvSwitch
vlan_id: 123 vlan_id: 123
@ -153,12 +152,11 @@ EXAMPLES = '''
state: present state: present
delegate_to: localhost delegate_to: localhost
- name: Create vlan trunk portgroup - name: Create vlan trunk portgroup
connection: local
vmware_dvs_portgroup: vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname hostname: '{{ vcenter_hostname }}'
username: vcenter_username username: '{{ vcenter_username }}'
password: vcenter_password password: '{{ vcenter_password }}'
portgroup_name: vlan-trunk-portrgoup portgroup_name: vlan-trunk-portrgoup
switch_name: dvSwitch switch_name: dvSwitch
vlan_id: 1-1000 vlan_id: 1-1000
@ -168,12 +166,11 @@ EXAMPLES = '''
state: present state: present
delegate_to: localhost delegate_to: localhost
- name: Create no-vlan portgroup - name: Create no-vlan portgroup
connection: local
vmware_dvs_portgroup: vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname hostname: '{{ vcenter_hostname }}'
username: vcenter_username username: '{{ vcenter_username }}'
password: vcenter_password password: '{{ vcenter_password }}'
portgroup_name: no-vlan-portrgoup portgroup_name: no-vlan-portrgoup
switch_name: dvSwitch switch_name: dvSwitch
vlan_id: 0 vlan_id: 0
@ -182,12 +179,11 @@ EXAMPLES = '''
state: present state: present
delegate_to: localhost delegate_to: localhost
- name: Create vlan portgroup with all security and port policies - name: Create vlan portgroup with all security and port policies
connection: local
vmware_dvs_portgroup: vmware_dvs_portgroup:
hostname: vcenter_ip_or_hostname hostname: '{{ vcenter_hostname }}'
username: vcenter_username username: '{{ vcenter_username }}'
password: vcenter_password password: '{{ vcenter_password }}'
portgroup_name: vlan-123-portrgoup portgroup_name: vlan-123-portrgoup
switch_name: dvSwitch switch_name: dvSwitch
vlan_id: 123 vlan_id: 123

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -61,13 +61,13 @@ extends_documentation_fragment: vmware.documentation
''' '''
EXAMPLES = ''' 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: vmware_guest_snapshot_facts:
hostname: 192.168.1.209 hostname: "{{ vcenter_hostname }}"
username: administrator@vsphere.local username: "{{ vcenter_username }}"
password: vmware password: "{{ vcenter_password }}"
datacenter: datacenter_name datacenter: "{{ datacenter_name }}"
name: dummy_vm name: "{{ guest_name }}"
delegate_to: localhost delegate_to: localhost
register: snapshot_facts register: snapshot_facts
''' '''

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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