From c72e2ee675fda2c6aa20ffa2ca8dac0b3be1f5c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Wed, 7 Oct 2020 11:33:55 -0400 Subject: [PATCH] import of the vmware_rest documentation (#72090) Co-authored-by: Jill R <4121322+jillr@users.noreply.github.com> --- .../rst/scenario_guides/guide_vmware.rst | 4 +- .../rst/scenario_guides/guide_vmware_rest.rst | 20 +++ docs/docsite/rst/scenario_guides/guides.rst | 1 + .../rst/scenario_guides/virt_guides.rst | 1 + .../vmware_rest_scenarios/authentication.rst | 47 ++++++ .../collect_information.rst | 109 +++++++++++++ .../vmware_rest_scenarios/create_vm.rst | 39 +++++ .../vmware_rest_scenarios/installation.rst | 44 +++++ .../vmware_rest_scenarios/run_a_vm.rst | 52 ++++++ .../Add_a_floppy_disk_drive.result.json | 15 ++ .../Add_a_floppy_disk_drive.task.yaml | 5 + .../Attach_a_VM_to_a_dvswitch.result.json | 23 +++ .../Attach_a_VM_to_a_dvswitch.task.yaml | 9 ++ ...ach_an_ISO_image_to_a_guest_VM.result.json | 19 +++ ...ttach_an_ISO_image_to_a_guest_VM.task.yaml | 12 ++ ...ild_a_list_of_all_the_clusters.result.json | 11 ++ ...Build_a_list_of_all_the_clusters.task.yaml | 3 + ...uild_a_list_of_all_the_folders.result.json | 10 ++ .../Build_a_list_of_all_the_folders.task.yaml | 3 + ..._VIRTUAL_MACHINE_and_called_vm.result.json | 10 ++ ...pe_VIRTUAL_MACHINE_and_called_vm.task.yaml | 6 + ...tools_upgrade_policy_to_MANUAL.result.json | 4 + ...m-tools_upgrade_policy_to_MANUAL.task.yaml | 5 + ...licy_to_UPGRADE_AT_POWER_CYCLE.result.json | 4 + ...policy_to_UPGRADE_AT_POWER_CYCLE.task.yaml | 5 + ...nformation_about_a_specific_VM.result.json | 77 +++++++++ ..._information_about_a_specific_VM.task.yaml | 4 + ...llect_the_hardware_information.result.json | 8 + ...Collect_the_hardware_information.task.yaml | 4 + ..._a_SATA_adapter_at_PCI_slot_34.result.json | 10 ++ ...te_a_SATA_adapter_at_PCI_slot_34.task.yaml | 5 + .../task_outputs/Create_a_VM.result.json | 77 +++++++++ .../task_outputs/Create_a_VM.task.yaml | 14 ++ .../Create_a_new_disk.result.json | 17 ++ .../task_outputs/Create_a_new_disk.task.yaml | 7 + .../Dedicate_one_core_to_the_VM.result.json | 10 ++ .../Dedicate_one_core_to_the_VM.task.yaml | 5 + .../Get_VM_storage_policy.result.json | 6 + .../Get_VM_storage_policy.task.yaml | 4 + ...t_guest_filesystem_information.result.json | 13 ++ ...Get_guest_filesystem_information.task.yaml | 8 + ...Get_guest_identity_information.result.json | 14 ++ .../Get_guest_identity_information.task.yaml | 4 + ...network_interfaces_information.result.json | 23 +++ ...t_network_interfaces_information.task.yaml | 4 + ...est_network_routes_information.result.json | 31 ++++ ...guest_network_routes_information.task.yaml | 4 + ...t_guest_networking_information.result.json | 17 ++ ...Get_guest_networking_information.task.yaml | 4 + .../Get_guest_power_information.result.json | 6 + .../Get_guest_power_information.task.yaml | 4 + .../Increase_the_memory_of_a_VM.result.json | 4 + .../Increase_the_memory_of_a_VM.task.yaml | 5 + ...the_SCSI_adapter_of_a_given_VM.result.json | 14 ++ ...t_the_SCSI_adapter_of_a_given_VM.task.yaml | 4 + ...the_cdrom_devices_on_the_guest.result.json | 4 + ...t_the_cdrom_devices_on_the_guest.task.yaml | 4 + ...lled_test_vm1_in_the_inventory.result.json | 12 ++ ...called_test_vm1_in_the_inventory.task.yaml | 5 + ...ve_SATA_adapter_at_PCI_slot_34.result.json | 3 + ...e_a_list_of_all_the_datastores.result.json | 26 +++ ...eve_a_list_of_all_the_datastores.task.yaml | 3 + ...etails_about_the_first_cluster.result.json | 8 + ..._details_about_the_first_cluster.task.yaml | 4 + ...e_disk_information_from_the_VM.result.json | 18 +++ ...the_disk_information_from_the_VM.task.yaml | 4 + ...memory_information_from_the_VM.result.json | 7 + ...e_memory_information_from_the_VM.task.yaml | 4 + ..._NIC's_start_connected_flag_on.result.json | 4 + ...he_NIC's_start_connected_flag_on.task.yaml | 5 + .../Turn_the_power_of_the_VM_on.result.json | 3 + .../Turn_the_power_of_the_VM_on.task.yaml | 4 + ...pgrade_the_VM_hardware_version.result.json | 4 + .../Upgrade_the_VM_hardware_version.task.yaml | 6 + .../Wait_until_my_VM_is_ready.result.json | 13 ++ .../Wait_until_my_VM_is_ready.task.yaml | 9 ++ ...lect_a_list_of_the_datacenters.result.json | 9 ++ ...ollect_a_list_of_the_datacenters.task.yaml | 3 + .../vm_hardware_tuning.rst | 150 ++++++++++++++++++ .../vmware_rest_scenarios/vm_info.rst | 129 +++++++++++++++ .../vm_tool_configuration.rst | 45 ++++++ .../vm_tool_information.rst | 90 +++++++++++ 82 files changed, 1442 insertions(+), 2 deletions(-) create mode 100644 docs/docsite/rst/scenario_guides/guide_vmware_rest.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/authentication.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/collect_information.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/create_vm.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/installation.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/run_a_vm.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Remove_SATA_adapter_at_PCI_slot_34.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.result.json create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.task.yaml create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_hardware_tuning.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_info.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_configuration.rst create mode 100644 docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_information.rst diff --git a/docs/docsite/rst/scenario_guides/guide_vmware.rst b/docs/docsite/rst/scenario_guides/guide_vmware.rst index b31553d552b..90b6703de1d 100644 --- a/docs/docsite/rst/scenario_guides/guide_vmware.rst +++ b/docs/docsite/rst/scenario_guides/guide_vmware.rst @@ -1,8 +1,8 @@ .. _vmware_ansible: -****************** +************ VMware Guide -****************** +************ Welcome to the Ansible for VMware Guide! diff --git a/docs/docsite/rst/scenario_guides/guide_vmware_rest.rst b/docs/docsite/rst/scenario_guides/guide_vmware_rest.rst new file mode 100644 index 00000000000..e93e352254f --- /dev/null +++ b/docs/docsite/rst/scenario_guides/guide_vmware_rest.rst @@ -0,0 +1,20 @@ +.. _vmware_rest_scenarios: + +**************************** +VMware REST Scenarios +**************************** + +These scenarios teach you how to accomplish common VMware tasks using the REST API and the Ansible ``vmware.vmware_rest`` collection. To get started, please select the task you want to accomplish. + +.. toctree:: + :maxdepth: 1 + + vmware_rest_scenarios/installation + vmware_rest_scenarios/authentication + vmware_rest_scenarios/collect_information + vmware_rest_scenarios/create_vm + vmware_rest_scenarios/vm_info + vmware_rest_scenarios/vm_hardware_tuning + vmware_rest_scenarios/run_a_vm + vmware_rest_scenarios/vm_tool_information + vmware_rest_scenarios/vm_tool_configuration diff --git a/docs/docsite/rst/scenario_guides/guides.rst b/docs/docsite/rst/scenario_guides/guides.rst index 2ff65bbc73e..53d092688e5 100644 --- a/docs/docsite/rst/scenario_guides/guides.rst +++ b/docs/docsite/rst/scenario_guides/guides.rst @@ -41,3 +41,4 @@ platforms, products, and technologies. They explore particular use cases in grea guide_kubernetes guide_vagrant guide_vmware + guide_vmware_rest diff --git a/docs/docsite/rst/scenario_guides/virt_guides.rst b/docs/docsite/rst/scenario_guides/virt_guides.rst index b623799fdcc..d7e53ad6561 100644 --- a/docs/docsite/rst/scenario_guides/virt_guides.rst +++ b/docs/docsite/rst/scenario_guides/virt_guides.rst @@ -13,3 +13,4 @@ The guides in this section cover integrating Ansible with popular tools for crea guide_kubernetes guide_vagrant guide_vmware + guide_vmware_rest diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/authentication.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/authentication.rst new file mode 100644 index 00000000000..79c55102fa2 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/authentication.rst @@ -0,0 +1,47 @@ +.. _vmware_rest_authentication: + +******************************************* +How to configure the vmware_rest collection +******************************************* + +.. contents:: + :local: + + +Introduction +============ + +The vcenter_rest modules need to be authenticated. There are two different + +Environment variables +===================== + +.. note:: + This solution requires that you call the modules from the local machine. + +You need to export some environment variables in your shell before you call the modules. + +.. code-block:: shell + + $ export VMWARE_HOST=vcenter.test + $ export VMWARE_USER=myvcenter-user + $ export VMWARE_password=mypassword + $ ansible-playbook my-playbook.yaml + +Module parameters +================= + +All the vcenter_rest modules accept the following arguments: + +- ``vcenter_host`` +- ``vcenter_username`` +- ``vcenter_password`` + + +Ignore SSL certificate error +============================ + +It's common to run a test environment without a proper SSL certificate configuration. + +To ignore the SSL error, you can use the ``vcenter_validate_certs: no`` argument or +``export VMWARE_VALIDATE_CERTS=no`` to set the environment variable. diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/collect_information.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/collect_information.rst new file mode 100644 index 00000000000..7ceb7e3c23a --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/collect_information.rst @@ -0,0 +1,109 @@ +.. _vmware_rest_collect_info: + +************************************************* +How to collect information about your environment +************************************************* + +.. contents:: + :local: + + +Introduction +============ + +This section shows you how to utilize Ansible to collect information about your environment. +This information is useful for the other tutorials. + +Scenario requirements +===================== + +In this scenario we've got a vCenter with an ESXi host. + +Our environment is pre-initialized with the following elements: + +- A datacenter called ``my_dc`` +- A cluster called ``my_cluser`` +- A cluster called ``my_cluser`` +- An ESXi host called ``esxi1`` is in the cluster +- Two datastores on the ESXi: ``rw_datastore`` and ``ro_datastore`` +- A dvswitch based guest network + +Finally, we use the environment variables to authenticate ourselves as explained in :ref:`vmware_rest_authentication`. + +How to collect information +========================== + +In these examples, we use the ``vcenter_*_info`` module to collect information about the associated resources. + +All these modules return a ``value`` key. Depending on the context, this ``value`` key will be either a list or a dictionary. + +Datacenter +---------- + +Here we use the ``vcenter_datacenter_info`` module to list all the datacenters: + +.. literalinclude:: task_outputs/collect_a_list_of_the_datacenters.task.yaml + +Result +______ + +As expected, the ``value`` key of the output is a list. + +.. literalinclude:: task_outputs/collect_a_list_of_the_datacenters.result.json + +Cluster +------- + +Here we do the same with ``vcenter_cluster_info``: + +.. literalinclude:: task_outputs/Build_a_list_of_all_the_clusters.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Build_a_list_of_all_the_clusters.result.json + +And we can also fetch the details about a specific cluster, with the ``cluster`` parameter: + +.. literalinclude:: task_outputs/Retrieve_details_about_the_first_cluster.task.yaml + +Result +______ + +And the ``value`` key of the output is this time a dictionary. + + +.. literalinclude:: task_outputs/Retrieve_details_about_the_first_cluster.result.json + +Datastore +--------- + +Here we use ``vcenter_datastore_info`` to get a list of all the datastores: + +.. literalinclude:: task_outputs/Retrieve_a_list_of_all_the_datastores.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Retrieve_a_list_of_all_the_datastores.result.json + +Folder +------ + +And here again, you use the ``vcenter_folder_info`` module to retrieve a list of all the folders. + +.. literalinclude:: task_outputs/Build_a_list_of_all_the_folders.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Build_a_list_of_all_the_folders.result.json + +Most of the time, you will just want one type of folder. In this case we can use filters to reduce the amount to collect. Most of the ``_info`` modules come with similar filters. + +.. literalinclude:: task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.result.json diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/create_vm.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/create_vm.rst new file mode 100644 index 00000000000..0e64bd0310e --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/create_vm.rst @@ -0,0 +1,39 @@ +.. _vmware_rest_create_vm: + +******************************* +How to create a Virtual Machine +******************************* + +.. contents:: + :local: + + +Introduction +============ + +This section shows you how to use Ansible to create a virtual machine. + +Scenario requirements +===================== + +You've already followed :ref:`vmware_rest_collect_info` and you've got the following variables defined: + +- ``my_cluster_info`` +- ``my_datastore`` +- ``my_virtual_machine_folder`` +- ``my_cluster_info`` + +How to create a virtual machine +=============================== + +In this example, we will use the ``vcenter_vm`` module to create a new guest. + +.. literalinclude:: task_outputs/Create_a_VM.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Create_a_VM.result.json + +.. note:: + ``vcenter_vm`` accepts more parameters, however you may prefer to start with a simple VM and use the ``vcenter_vm_hardware`` modules to tune it up afterwards. It's easier this way to identify a potential problematical step. diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/installation.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/installation.rst new file mode 100644 index 00000000000..7516d0fd455 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/installation.rst @@ -0,0 +1,44 @@ +.. _vmware_rest_installation: + +***************************************** +How to install the vmware_rest collection +***************************************** + +.. contents:: + :local: + + +Requirements +============ + +The collection depends on: + +- Ansible >=2.9.10 or greater +- Python 3.6 or greater + +aiohttp +======= + +aiohttp_ is the only dependency of the collection. You can install it with ``pip`` if you use a virtualenv to run Ansible. + +.. code-block:: shell + + $ pip install aiohttp + +Or using an RPM. + +.. code-block:: shell + + $ sudo dnf install python3-aiohttp + +.. _aiohttp: https://docs.aiohttp.org/en/stable/ + +Installation +============ + +The best option to install the collection is to use the ``ansible-galaxy`` command: + +.. code-block:: shell + + + $ ansible-galaxy collection install vmware.vmware_rest diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/run_a_vm.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/run_a_vm.rst new file mode 100644 index 00000000000..be723866e78 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/run_a_vm.rst @@ -0,0 +1,52 @@ +.. _vmware_rest_run_a_vm: + +**************************** +How to run a virtual machine +**************************** + +.. contents:: + :local: + + +Introduction +============ + +This section covers the power management of your virtual machine. + +Power information +================= + +Use ``vcenter_vm_power_info`` to know the power state of the VM. + +.. literalinclude:: task_outputs/Get_guest_power_information.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Get_guest_power_information.result.json + + +How to start a virtual machine +============================== + +Use the ``vcenter_vm_power`` module to start your VM: + +.. literalinclude:: task_outputs/Turn_the_power_of_the_VM_on.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Turn_the_power_of_the_VM_on.result.json + +How to wait until my virtual machine is ready +============================================= + +If your virtual machine runs VMware Tools, you can build a loop +around the ``center_vm_tools_info`` module: + +.. literalinclude:: task_outputs/Wait_until_my_VM_is_ready.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Wait_until_my_VM_is_ready.result.json diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.result.json new file mode 100644 index 00000000000..c4bf5cd0e22 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.result.json @@ -0,0 +1,15 @@ +{ + "value": { + "start_connected": false, + "backing": { + "auto_detect": true, + "type": "HOST_DEVICE", + "host_device": "" + }, + "allow_guest_control": true, + "label": "Floppy drive 1", + "state": "NOT_CONNECTED" + }, + "id": "8000", + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.task.yaml new file mode 100644 index 00000000000..d1e2ca6d84a --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Add_a_floppy_disk_drive.task.yaml @@ -0,0 +1,5 @@ +- name: Add a floppy disk drive + vcenter_vm_hardware_floppy: + vm: '{{ test_vm1_info.id }}' + allow_guest_control: true + register: my_floppy_drive diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.result.json new file mode 100644 index 00000000000..fbb5a6f15d9 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.result.json @@ -0,0 +1,23 @@ +{ + "value": { + "start_connected": false, + "pci_slot_number": 4, + "backing": { + "connection_cookie": 2145337177, + "distributed_switch_uuid": "50 33 88 3a 8c 6e f9 02-7a fd c2 c0 2c cf f2 ac", + "distributed_port": "2", + "type": "DISTRIBUTED_PORTGROUP", + "network": "dvportgroup-1649" + }, + "mac_address": "00:50:56:b3:49:5c", + "mac_type": "ASSIGNED", + "allow_guest_control": false, + "wake_on_lan_enabled": false, + "label": "Network adapter 1", + "state": "NOT_CONNECTED", + "type": "VMXNET3", + "upt_compatibility_enabled": false + }, + "id": "4000", + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.task.yaml new file mode 100644 index 00000000000..43bc682b02b --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_a_VM_to_a_dvswitch.task.yaml @@ -0,0 +1,9 @@ +- name: Attach a VM to a dvswitch + vcenter_vm_hardware_ethernet: + vm: '{{ test_vm1_info.id }}' + pci_slot_number: 4 + backing: + type: DISTRIBUTED_PORTGROUP + network: "{{ my_portgroup_info.dvs_portgroup_info.dvswitch1[0].key }}" + start_connected: false + register: _vm_hardware_ethernet_1 diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.result.json new file mode 100644 index 00000000000..ee456cb1fe6 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.result.json @@ -0,0 +1,19 @@ +{ + "value": { + "start_connected": true, + "backing": { + "iso_file": "[ro_datastore] fedora.iso", + "type": "ISO_FILE" + }, + "allow_guest_control": false, + "label": "CD/DVD drive 1", + "state": "NOT_CONNECTED", + "type": "SATA", + "sata": { + "bus": 0, + "unit": 2 + } + }, + "id": "16002", + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.task.yaml new file mode 100644 index 00000000000..4b7cc6ceb58 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Attach_an_ISO_image_to_a_guest_VM.task.yaml @@ -0,0 +1,12 @@ +- name: Attach an ISO image to a guest VM + vcenter_vm_hardware_cdrom: + vm: '{{ test_vm1_info.id }}' + type: SATA + sata: + bus: 0 + unit: 2 + start_connected: true + backing: + iso_file: '[ro_datastore] fedora.iso' + type: ISO_FILE + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.result.json new file mode 100644 index 00000000000..3415fae6f6e --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.result.json @@ -0,0 +1,11 @@ +{ + "value": [ + { + "drs_enabled": false, + "cluster": "domain-c1636", + "name": "my_cluster", + "ha_enabled": false + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.task.yaml new file mode 100644 index 00000000000..99f910a6fc5 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_clusters.task.yaml @@ -0,0 +1,3 @@ +- name: Build a list of all the clusters + vcenter_cluster_info: + register: all_the_clusters diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.result.json new file mode 100644 index 00000000000..516234d4c69 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.result.json @@ -0,0 +1,10 @@ +{ + "value": [ + { + "folder": "group-d1", + "name": "Datacenters", + "type": "DATACENTER" + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.task.yaml new file mode 100644 index 00000000000..c595c32d47b --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders.task.yaml @@ -0,0 +1,3 @@ +- name: Build a list of all the folders + vcenter_folder_info: + register: my_folders diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.result.json new file mode 100644 index 00000000000..ecf53f73ebb --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.result.json @@ -0,0 +1,10 @@ +{ + "value": [ + { + "folder": "group-v1631", + "name": "vm", + "type": "VIRTUAL_MACHINE" + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.task.yaml new file mode 100644 index 00000000000..026b8522171 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Build_a_list_of_all_the_folders_with_the_type_VIRTUAL_MACHINE_and_called_vm.task.yaml @@ -0,0 +1,6 @@ +- name: Build a list of all the folders with the type VIRTUAL_MACHINE and called vm + vcenter_folder_info: + filter_type: VIRTUAL_MACHINE + filter_names: + - vm + register: my_folders diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.result.json new file mode 100644 index 00000000000..e15f41c5fae --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.result.json @@ -0,0 +1,4 @@ +{ + "id": null, + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.task.yaml new file mode 100644 index 00000000000..6e7fb4fce53 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.task.yaml @@ -0,0 +1,5 @@ +- name: Change vm-tools upgrade policy to MANUAL + vcenter_vm_tools: + vm: '{{ test_vm1_info.id }}' + upgrade_policy: MANUAL + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.result.json new file mode 100644 index 00000000000..e15f41c5fae --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.result.json @@ -0,0 +1,4 @@ +{ + "id": null, + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.task.yaml new file mode 100644 index 00000000000..acfcea62a35 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.task.yaml @@ -0,0 +1,5 @@ +- name: Change vm-tools upgrade policy to UPGRADE_AT_POWER_CYCLE + vcenter_vm_tools: + vm: '{{ test_vm1_info.id }}' + upgrade_policy: UPGRADE_AT_POWER_CYCLE + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.result.json new file mode 100644 index 00000000000..d0f17cbb719 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.result.json @@ -0,0 +1,77 @@ +{ + "value": { + "instant_clone_frozen": false, + "cdroms": [], + "memory": { + "size_MiB": 1024, + "hot_add_enabled": true + }, + "disks": [ + { + "value": { + "scsi": { + "bus": 0, + "unit": 0 + }, + "backing": { + "vmdk_file": "[local] test_vm1_8/test_vm1.vmdk", + "type": "VMDK_FILE" + }, + "label": "Hard disk 1", + "type": "SCSI", + "capacity": 17179869184 + }, + "key": "2000" + } + ], + "parallel_ports": [], + "sata_adapters": [], + "cpu": { + "hot_remove_enabled": false, + "count": 1, + "hot_add_enabled": false, + "cores_per_socket": 1 + }, + "scsi_adapters": [ + { + "value": { + "scsi": { + "bus": 0, + "unit": 7 + }, + "label": "SCSI controller 0", + "sharing": "NONE", + "type": "PVSCSI" + }, + "key": "1000" + } + ], + "power_state": "POWERED_OFF", + "floppies": [], + "identity": { + "name": "test_vm1", + "instance_uuid": "5033c296-6954-64df-faca-d001de53763d", + "bios_uuid": "42330d17-e603-d925-fa4b-18827dbc1409" + }, + "nvme_adapters": [], + "name": "test_vm1", + "nics": [], + "boot": { + "delay": 0, + "retry_delay": 10000, + "enter_setup_mode": false, + "type": "BIOS", + "retry": false + }, + "serial_ports": [], + "boot_devices": [], + "guest_OS": "DEBIAN_8_64", + "hardware": { + "upgrade_policy": "NEVER", + "upgrade_status": "NONE", + "version": "VMX_11" + } + }, + "id": "vm-1650", + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.task.yaml new file mode 100644 index 00000000000..0df3332165d --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_information_about_a_specific_VM.task.yaml @@ -0,0 +1,4 @@ +- name: Collect information about a specific VM + vcenter_vm_info: + vm: '{{ search_result.value[0].vm }}' + register: test_vm1_info diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.result.json new file mode 100644 index 00000000000..c2e162c5db2 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.result.json @@ -0,0 +1,8 @@ +{ + "value": { + "upgrade_policy": "NEVER", + "upgrade_status": "NONE", + "version": "VMX_11" + }, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.task.yaml new file mode 100644 index 00000000000..3d0c974e414 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Collect_the_hardware_information.task.yaml @@ -0,0 +1,4 @@ +- name: Collect the hardware information + vcenter_vm_hardware_info: + vm: '{{ search_result.value[0].vm }}' + register: my_vm1_hardware_info diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.result.json new file mode 100644 index 00000000000..62ae281ec05 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.result.json @@ -0,0 +1,10 @@ +{ + "value": { + "bus": 0, + "pci_slot_number": 34, + "label": "SATA controller 0", + "type": "AHCI" + }, + "id": "15000", + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.task.yaml new file mode 100644 index 00000000000..6348a004239 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.task.yaml @@ -0,0 +1,5 @@ +- name: Create a SATA adapter at PCI slot 34 + vcenter_vm_hardware_adapter_sata: + vm: '{{ test_vm1_info.id }}' + pci_slot_number: 34 + register: _sata_adapter_result_1 diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.result.json new file mode 100644 index 00000000000..d309d076a04 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.result.json @@ -0,0 +1,77 @@ +{ + "value": { + "instant_clone_frozen": false, + "cdroms": [], + "memory": { + "size_MiB": 1024, + "hot_add_enabled": true + }, + "disks": [ + { + "value": { + "scsi": { + "bus": 0, + "unit": 0 + }, + "backing": { + "vmdk_file": "[local] test_vm1_8/test_vm1.vmdk", + "type": "VMDK_FILE" + }, + "label": "Hard disk 1", + "type": "SCSI", + "capacity": 17179869184 + }, + "key": "2000" + } + ], + "parallel_ports": [], + "sata_adapters": [], + "cpu": { + "hot_remove_enabled": false, + "count": 1, + "hot_add_enabled": false, + "cores_per_socket": 1 + }, + "scsi_adapters": [ + { + "value": { + "scsi": { + "bus": 0, + "unit": 7 + }, + "label": "SCSI controller 0", + "sharing": "NONE", + "type": "PVSCSI" + }, + "key": "1000" + } + ], + "power_state": "POWERED_OFF", + "floppies": [], + "identity": { + "name": "test_vm1", + "instance_uuid": "5033c296-6954-64df-faca-d001de53763d", + "bios_uuid": "42330d17-e603-d925-fa4b-18827dbc1409" + }, + "nvme_adapters": [], + "name": "test_vm1", + "nics": [], + "boot": { + "delay": 0, + "retry_delay": 10000, + "enter_setup_mode": false, + "type": "BIOS", + "retry": false + }, + "serial_ports": [], + "boot_devices": [], + "guest_OS": "DEBIAN_8_64", + "hardware": { + "upgrade_policy": "NEVER", + "upgrade_status": "NONE", + "version": "VMX_11" + } + }, + "id": "vm-1650", + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.task.yaml new file mode 100644 index 00000000000..7695aa6d7da --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_VM.task.yaml @@ -0,0 +1,14 @@ +- name: Create a VM + vcenter_vm: + placement: + cluster: "{{ my_cluster_info.id }}" + datastore: "{{ my_datastore.datastore }}" + folder: "{{ my_virtual_machine_folder.folder }}" + resource_pool: "{{ my_cluster_info.value.resource_pool }}" + name: test_vm1 + guest_OS: DEBIAN_8_64 + hardware_version: VMX_11 + memory: + hot_add_enabled: true + size_MiB: 1024 + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.result.json new file mode 100644 index 00000000000..7b4275ca7a1 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.result.json @@ -0,0 +1,17 @@ +{ + "value": { + "backing": { + "vmdk_file": "[local] test_vm1_8/test_vm1_1.vmdk", + "type": "VMDK_FILE" + }, + "label": "Hard disk 2", + "type": "SATA", + "sata": { + "bus": 0, + "unit": 0 + }, + "capacity": 320000 + }, + "id": "16000", + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.task.yaml new file mode 100644 index 00000000000..830ae6ddaa5 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Create_a_new_disk.task.yaml @@ -0,0 +1,7 @@ +- name: Create a new disk + vcenter_vm_hardware_disk: + vm: '{{ test_vm1_info.id }}' + type: SATA + new_vmdk: + capacity: 320000 + register: my_new_disk diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.result.json new file mode 100644 index 00000000000..8d2169bbb26 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.result.json @@ -0,0 +1,10 @@ +{ + "value": { + "hot_remove_enabled": false, + "count": 1, + "hot_add_enabled": false, + "cores_per_socket": 1 + }, + "id": null, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.task.yaml new file mode 100644 index 00000000000..712783b37b9 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Dedicate_one_core_to_the_VM.task.yaml @@ -0,0 +1,5 @@ +- name: Dedicate one core to the VM + vcenter_vm_hardware_cpu: + vm: '{{ test_vm1_info.id }}' + count: 1 + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.result.json new file mode 100644 index 00000000000..204ad5f9afb --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.result.json @@ -0,0 +1,6 @@ +{ + "value": { + "disks": [] + }, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.task.yaml new file mode 100644 index 00000000000..41b3edbbabf --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_VM_storage_policy.task.yaml @@ -0,0 +1,4 @@ +- name: Get VM storage policy + vcenter_vm_storage_policy_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.result.json new file mode 100644 index 00000000000..ad87f76d203 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.result.json @@ -0,0 +1,13 @@ +{ + "value": [ + { + "value": { + "mappings": [], + "free_space": 774766592, + "capacity": 2515173376 + }, + "key": "/" + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.task.yaml new file mode 100644 index 00000000000..10dd33cb26a --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_filesystem_information.task.yaml @@ -0,0 +1,8 @@ +- name: Get guest filesystem information + vcenter_vm_guest_localfilesystem_info: + vm: '{{ test_vm1_info.id }}' + register: _result + until: + - _result is not failed + retries: 60 + delay: 5 diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.result.json new file mode 100644 index 00000000000..01e8a8fd1c9 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.result.json @@ -0,0 +1,14 @@ +{ + "value": { + "full_name": { + "args": [], + "default_message": "Red Hat Fedora (64-bit)", + "id": "vmsg.guestos.fedora64Guest.label" + }, + "name": "FEDORA_64", + "ip_address": "192.168.122.242", + "family": "LINUX", + "host_name": "localhost.localdomain" + }, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.task.yaml new file mode 100644 index 00000000000..04f3f59abbf --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_identity_information.task.yaml @@ -0,0 +1,4 @@ +- name: Get guest identity information + vcenter_vm_guest_identity_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.result.json new file mode 100644 index 00000000000..2c973374afc --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.result.json @@ -0,0 +1,23 @@ +{ + "value": [ + { + "mac_address": "00:50:56:b3:49:5c", + "ip": { + "ip_addresses": [ + { + "ip_address": "192.168.122.242", + "prefix_length": 24, + "state": "PREFERRED" + }, + { + "ip_address": "fe80::b8d0:511b:897f:65a2", + "prefix_length": 64, + "state": "UNKNOWN" + } + ] + }, + "nic": "4000" + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.task.yaml new file mode 100644 index 00000000000..4d4b4f2e9fb --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_interfaces_information.task.yaml @@ -0,0 +1,4 @@ +- name: Get guest network interfaces information + vcenter_vm_guest_networking_interfaces_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.result.json new file mode 100644 index 00000000000..68e2033dd73 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.result.json @@ -0,0 +1,31 @@ +{ + "value": [ + { + "gateway_address": "192.168.122.1", + "interface_index": 0, + "prefix_length": 0, + "network": "0.0.0.0" + }, + { + "interface_index": 0, + "prefix_length": 24, + "network": "192.168.122.0" + }, + { + "interface_index": 0, + "prefix_length": 64, + "network": "fe80::" + }, + { + "interface_index": 0, + "prefix_length": 128, + "network": "fe80::b8d0:511b:897f:65a2" + }, + { + "interface_index": 0, + "prefix_length": 8, + "network": "ff00::" + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.task.yaml new file mode 100644 index 00000000000..343990cc0d7 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_network_routes_information.task.yaml @@ -0,0 +1,4 @@ +- name: Get guest network routes information + vcenter_vm_guest_networking_routes_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.result.json new file mode 100644 index 00000000000..fe757b647cc --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.result.json @@ -0,0 +1,17 @@ +{ + "value": { + "dns": { + "ip_addresses": [ + "10.0.2.3" + ], + "search_domains": [ + "localdomain" + ] + }, + "dns_values": { + "domain_name": "localdomain", + "host_name": "localhost.localdomain" + } + }, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.task.yaml new file mode 100644 index 00000000000..6c005d11ce5 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_networking_information.task.yaml @@ -0,0 +1,4 @@ +- name: Get guest networking information + vcenter_vm_guest_networking_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.result.json new file mode 100644 index 00000000000..da317782489 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.result.json @@ -0,0 +1,6 @@ +{ + "value": { + "state": "POWERED_ON" + }, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.task.yaml new file mode 100644 index 00000000000..469a8b074ce --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Get_guest_power_information.task.yaml @@ -0,0 +1,4 @@ +- name: Get guest power information + vcenter_vm_power_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.result.json new file mode 100644 index 00000000000..e15f41c5fae --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.result.json @@ -0,0 +1,4 @@ +{ + "id": null, + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.task.yaml new file mode 100644 index 00000000000..a3bbc1eed10 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Increase_the_memory_of_a_VM.task.yaml @@ -0,0 +1,5 @@ +- name: Increase the memory of a VM + vcenter_vm_hardware_memory: + vm: '{{ test_vm1_info.id }}' + size_MiB: 1080 + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.result.json new file mode 100644 index 00000000000..3ecaa4bdbcf --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.result.json @@ -0,0 +1,14 @@ +{ + "value": [ + { + "scsi": { + "bus": 0, + "unit": 7 + }, + "label": "SCSI controller 0", + "type": "PVSCSI", + "sharing": "NONE" + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.task.yaml new file mode 100644 index 00000000000..c0a669c13cd --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_SCSI_adapter_of_a_given_VM.task.yaml @@ -0,0 +1,4 @@ +- name: List the SCSI adapter of a given VM + vcenter_vm_hardware_adapter_scsi_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.result.json new file mode 100644 index 00000000000..a838aa542fc --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.result.json @@ -0,0 +1,4 @@ +{ + "value": [], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.task.yaml new file mode 100644 index 00000000000..f6c76df8ad7 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/List_the_cdrom_devices_on_the_guest.task.yaml @@ -0,0 +1,4 @@ +- name: List the cdrom devices on the guest + vcenter_vm_hardware_cdrom_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.result.json new file mode 100644 index 00000000000..3b5e197e5a1 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.result.json @@ -0,0 +1,12 @@ +{ + "value": [ + { + "memory_size_MiB": 1024, + "vm": "vm-1650", + "name": "test_vm1", + "power_state": "POWERED_OFF", + "cpu_count": 1 + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.task.yaml new file mode 100644 index 00000000000..b0c1368c9a2 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.task.yaml @@ -0,0 +1,5 @@ +- name: Look up the VM called test_vm1 in the inventory + register: search_result + vcenter_vm_info: + filter_names: + - test_vm1 diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Remove_SATA_adapter_at_PCI_slot_34.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Remove_SATA_adapter_at_PCI_slot_34.result.json new file mode 100644 index 00000000000..aac751af72e --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Remove_SATA_adapter_at_PCI_slot_34.result.json @@ -0,0 +1,3 @@ +{ + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.result.json new file mode 100644 index 00000000000..48c3cf80b78 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.result.json @@ -0,0 +1,26 @@ +{ + "value": [ + { + "datastore": "datastore-1644", + "name": "local", + "type": "VMFS", + "free_space": 13523484672, + "capacity": 15032385536 + }, + { + "datastore": "datastore-1645", + "name": "ro_datastore", + "type": "NFS", + "free_space": 24638349312, + "capacity": 26831990784 + }, + { + "datastore": "datastore-1646", + "name": "rw_datastore", + "type": "NFS", + "free_space": 24638349312, + "capacity": 26831990784 + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.task.yaml new file mode 100644 index 00000000000..ff4f4bcea12 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_a_list_of_all_the_datastores.task.yaml @@ -0,0 +1,3 @@ +- name: Retrieve a list of all the datastores + vcenter_datastore_info: + register: my_datastores diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.result.json new file mode 100644 index 00000000000..7c86727a827 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.result.json @@ -0,0 +1,8 @@ +{ + "value": { + "name": "my_cluster", + "resource_pool": "resgroup-1637" + }, + "id": "domain-c1636", + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.task.yaml new file mode 100644 index 00000000000..b0754855c9f --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_details_about_the_first_cluster.task.yaml @@ -0,0 +1,4 @@ +- name: Retrieve details about the first cluster + vcenter_cluster_info: + cluster: "{{ all_the_clusters.value[0].cluster }}" + register: my_cluster_info diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.result.json new file mode 100644 index 00000000000..922250ed0ca --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.result.json @@ -0,0 +1,18 @@ +{ + "value": [ + { + "scsi": { + "bus": 0, + "unit": 0 + }, + "backing": { + "vmdk_file": "[local] test_vm1_8/test_vm1.vmdk", + "type": "VMDK_FILE" + }, + "label": "Hard disk 1", + "type": "SCSI", + "capacity": 17179869184 + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.task.yaml new file mode 100644 index 00000000000..9722a66f4c8 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_disk_information_from_the_VM.task.yaml @@ -0,0 +1,4 @@ +- name: Retrieve the disk information from the VM + vcenter_vm_hardware_disk_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.result.json new file mode 100644 index 00000000000..88436c13af0 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.result.json @@ -0,0 +1,7 @@ +{ + "value": { + "size_MiB": 1024, + "hot_add_enabled": true + }, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.task.yaml new file mode 100644 index 00000000000..96046f37159 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Retrieve_the_memory_information_from_the_VM.task.yaml @@ -0,0 +1,4 @@ +- name: Retrieve the memory information from the VM + vcenter_vm_hardware_memory_info: + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.result.json new file mode 100644 index 00000000000..9c0c9c1f407 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.result.json @@ -0,0 +1,4 @@ +{ + "id": "4000", + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.task.yaml new file mode 100644 index 00000000000..d343b510cb6 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_NIC's_start_connected_flag_on.task.yaml @@ -0,0 +1,5 @@ +- name: Turn the NIC's start_connected flag on + vcenter_vm_hardware_ethernet: + nic: '{{ _vm_hardware_ethernet_1.id }}' + start_connected: true + vm: '{{ test_vm1_info.id }}' diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.result.json new file mode 100644 index 00000000000..a661aa055d3 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.result.json @@ -0,0 +1,3 @@ +{ + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.task.yaml new file mode 100644 index 00000000000..47bcbc985b2 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Turn_the_power_of_the_VM_on.task.yaml @@ -0,0 +1,4 @@ +- name: Turn the power of the VM on + vcenter_vm_power: + state: start + vm: '{{ test_vm1_info.id }}' diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.result.json new file mode 100644 index 00000000000..e15f41c5fae --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.result.json @@ -0,0 +1,4 @@ +{ + "id": null, + "changed": true +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.task.yaml new file mode 100644 index 00000000000..a6140579f80 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Upgrade_the_VM_hardware_version.task.yaml @@ -0,0 +1,6 @@ +- name: Upgrade the VM hardware version + vcenter_vm_hardware: + upgrade_policy: AFTER_CLEAN_SHUTDOWN + upgrade_version: VMX_13 + vm: '{{ test_vm1_info.id }}' + register: _result diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.result.json new file mode 100644 index 00000000000..849bde48318 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.result.json @@ -0,0 +1,13 @@ +{ + "value": { + "auto_update_supported": false, + "upgrade_policy": "MANUAL", + "install_attempt_count": 0, + "version_status": "UNMANAGED", + "version_number": 10346, + "run_state": "RUNNING", + "version": "10346", + "install_type": "OPEN_VM_TOOLS" + }, + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.task.yaml new file mode 100644 index 00000000000..35eabe9750b --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/Wait_until_my_VM_is_ready.task.yaml @@ -0,0 +1,9 @@ +- name: Wait until my VM is ready + vcenter_vm_tools_info: + vm: '{{ test_vm1_info.id }}' + register: vm_tools_info + until: + - vm_tools_info is not failed + - vm_tools_info.value.run_state != "NOT_RUNNING" + retries: 60 + delay: 5 diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.result.json b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.result.json new file mode 100644 index 00000000000..1225ad7f93a --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.result.json @@ -0,0 +1,9 @@ +{ + "value": [ + { + "name": "my_dc", + "datacenter": "datacenter-1630" + } + ], + "changed": false +} \ No newline at end of file diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.task.yaml b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.task.yaml new file mode 100644 index 00000000000..54ec5975b1b --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/task_outputs/collect_a_list_of_the_datacenters.task.yaml @@ -0,0 +1,3 @@ +- name: collect a list of the datacenters + vcenter_datacenter_info: + register: my_datacenters diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_hardware_tuning.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_hardware_tuning.rst new file mode 100644 index 00000000000..1af1d5b5af5 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_hardware_tuning.rst @@ -0,0 +1,150 @@ +.. _vmware_rest_vm_hardware_tuning: + +******************************* +How to modify a virtual machine +******************************* + +.. contents:: + :local: + + +Introduction +============ + +This section shows you how to use Ansible to modify an existing virtual machine. + +Scenario requirements +===================== + +You've already followed :ref:`vmware_rest_create_vm` and created a VM. + +How to add a CDROM drive to a virtual machine +============================================= + +In this example, we use the ``vcenter_vm_hardware_*`` modules to add a new CDROM to an existing VM. + +Add a new SATA adapter +______________________ + +First we create a new SATA adapter. We specify the ``pci_slot_number``. This way if we run the task again it won't do anything if there is already an adapter there. + +.. literalinclude:: task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Create_a_SATA_adapter_at_PCI_slot_34.result.json + +Add a CDROM drive +_________________ + +Now we can create the CDROM drive: + +.. literalinclude:: task_outputs/Attach_an_ISO_image_to_a_guest_VM.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Attach_an_ISO_image_to_a_guest_VM.result.json + + +.. _vmware_rest_attach_a_network: + +How to attach a VM to a network +=============================== + +Attach a new NIC +________________ + +Here we attach the VM to the network (through the portgroup). We specify a ``pci_slot_number`` for the same reason. + +The second task adjusts the NIC configuration. + +.. literalinclude:: task_outputs/Attach_a_VM_to_a_dvswitch.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Attach_a_VM_to_a_dvswitch.result.json + +Adjust the configuration of the NIC +___________________________________ + +.. literalinclude:: task_outputs/Turn_the_NIC's_start_connected_flag_on.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Turn_the_NIC's_start_connected_flag_on.result.json + +Increase the memory of the VM +============================= + +We can also adjust the amount of memory that we dedicate to our VM. + +.. literalinclude:: task_outputs/Increase_the_memory_of_a_VM.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Increase_the_memory_of_a_VM.result.json + +Upgrade the hardware version of the VM +====================================== + +Here we use the ``vcenter_vm_hardware`` module to upgrade the version of the hardware: + +.. literalinclude:: task_outputs/Upgrade_the_VM_hardware_version.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Upgrade_the_VM_hardware_version.result.json + +Adjust the number of CPUs of the VM +=================================== + +You can use ``vcenter_vm_hardware_cpu`` for that: + +.. literalinclude:: task_outputs/Dedicate_one_core_to_the_VM.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Dedicate_one_core_to_the_VM.result.json + +Remove a SATA controller +======================== + +In this example, we remove the SATA controller of the PCI slot 34. + +.. literalinclude:: task_outputs/Remove_SATA_adapter_at_PCI_slot_34.result.json + +Result +______ + +.. literalinclude:: task_outputs/Remove_SATA_adapter_at_PCI_slot_34.result.json + +Attach a floppy drive +===================== + +Here we attach a floppy drive to a VM. + +.. literalinclude:: task_outputs/Add_a_floppy_disk_drive.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Add_a_floppy_disk_drive.result.json + +Attach a new disk +================= + +Here we attach a tiny disk to the VM. The ``capacity`` is in bytes. + +.. literalinclude:: task_outputs/Create_a_new_disk.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Create_a_new_disk.result.json diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_info.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_info.rst new file mode 100644 index 00000000000..097b69b1a13 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_info.rst @@ -0,0 +1,129 @@ +.. _vmware_rest_vm_info: + +*************************************** +Retrieve information from a specific VM +*************************************** + +.. contents:: + :local: + + +Introduction +============ + +This section shows you how to use Ansible to retrieve information about a specific virtual machine. + +Scenario requirements +===================== + +You've already followed :ref:`vmware_rest_create_vm` and you've got create a new VM called ``test_vm1``. + +How to collect virtual machine information +========================================== + +List the VM +___________ + +In this example, we use the ``vcenter_vm_info`` module to collect information about our new VM. + +In this example, we start by asking for a list of VMs. We use a filter to limit the results to just the VM called ``test_vm1``. So we are in a list context, with one single entry in the ``value`` key. + +.. literalinclude:: task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.task.yaml + +Result +______ + +As expected, we get a list. And thanks to our filter, we just get one entry. + +.. literalinclude:: task_outputs/Look_up_the_VM_called_test_vm1_in_the_inventory.result.json + +Collect the details about a specific VM +_______________________________________ + +For the next steps, we pass the ID of the VM through the ``vm`` parameter. This allow us to collect more details about this specific VM. + +.. literalinclude:: task_outputs/Collect_information_about_a_specific_VM.task.yaml + +Result +______ + +The result is a structure with all the details about our VM. You will note this is actually the same information that we get when we created the VM. + +.. literalinclude:: task_outputs/Collect_information_about_a_specific_VM.result.json + + +Get the hardware version of a specific VM +_________________________________________ + +We can also use all the ``vcenter_vm_*_info`` modules to retrieve a smaller amount +of information. Here we use ``vcenter_vm_hardware_info`` to know the hardware version of +the VM. + +.. literalinclude:: task_outputs/Collect_the_hardware_information.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Collect_the_hardware_information.result.json + +List the SCSI adapter(s) of a specific VM +_________________________________________ + +Here for instance, we list the SCSI adapter(s) of the VM: + +.. literalinclude:: task_outputs/List_the_SCSI_adapter_of_a_given_VM.task.yaml + +You can do the same for the SATA controllers with ``vcenter_vm_adapter_sata_info``. + +Result +______ + +.. literalinclude:: task_outputs/List_the_SCSI_adapter_of_a_given_VM.result.json + +List the CDROM drive(s) of a specific VM +________________________________________ + +And we list its CDROM drives. + +.. literalinclude:: task_outputs/List_the_cdrom_devices_on_the_guest.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/List_the_cdrom_devices_on_the_guest.result.json + +Get the memory information of the VM +____________________________________ + +Here we collect the memory information of the VM: + +.. literalinclude:: task_outputs/Retrieve_the_memory_information_from_the_VM.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Retrieve_the_memory_information_from_the_VM.result.json + +Get the storage policy of the VM +-------------------------------- + +We use the ``vcenter_vm_storage_policy_info`` module for that: + +.. literalinclude:: task_outputs/Get_VM_storage_policy.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Get_VM_storage_policy.result.json + +Get the disk information of the VM +---------------------------------- + +We use the ``vcenter_vm_hardware_disk_info`` for this operation: + +.. literalinclude:: task_outputs/Retrieve_the_disk_information_from_the_VM.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Retrieve_the_disk_information_from_the_VM.result.json diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_configuration.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_configuration.rst new file mode 100644 index 00000000000..b29447aec52 --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_configuration.rst @@ -0,0 +1,45 @@ +.. _vmware_rest_vm_tool_configuration: + +************************************************************** +How to configure the VMware tools of a running virtual machine +************************************************************** + +.. contents:: + :local: + + +Introduction +============ + +This section show you how to collection information from a running virtual machine. + +Scenario requirements +===================== + +You've already followed :ref:`vmware_rest_run_a_vm` and your virtual machine runs VMware Tools. + +How to change the upgrade policy +================================ + +Change the upgrade policy to MANUAL +--------------------------------------------------- + +You can adjust the VMware Tools upgrade policy with the ``vcenter_vm_tools`` module. + +.. literalinclude:: task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Change_vm-tools_upgrade_policy_to_MANUAL.result.json + + +Change the upgrade policy to UPGRADE_AT_POWER_CYCLE +------------------------------------------------------------------------------------------ + +.. literalinclude:: task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Change_vm-tools_upgrade_policy_to_UPGRADE_AT_POWER_CYCLE.result.json diff --git a/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_information.rst b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_information.rst new file mode 100644 index 00000000000..24d18bf778a --- /dev/null +++ b/docs/docsite/rst/scenario_guides/vmware_rest_scenarios/vm_tool_information.rst @@ -0,0 +1,90 @@ +.. _vmware_rest_vm_tool_information: + +***************************************************** +How to get information from a running virtual machine +***************************************************** + +.. contents:: + :local: + + +Introduction +============ + +This section shows you how to collection information from a running virtual machine. + +Scenario requirements +===================== + +You've already followed :ref:`vmware_rest_run_a_vm` and your virtual machine runs VMware Tools. + +How to collect information +========================== + +In this example, we use the ``vcenter_vm_guest_*`` module to collect information about the associated resources. + +Filesystem +---------- + +Here we use ``vcenter_vm_guest_localfilesystem_info`` to retrieve the details +about the filesystem of the guest. In this example we also use a ``retries`` +loop. The VMware Tools may take a bit of time to start and by doing so, we give +the VM a bit more time. + +.. literalinclude:: task_outputs/Get_guest_filesystem_information.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Get_guest_filesystem_information.result.json + +Guest identity +-------------- + +You can use ``vcenter_vm_guest_identity_info`` to get details like the OS family or the hostname of the running VM. + +.. literalinclude:: task_outputs/Get_guest_identity_information.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Get_guest_identity_information.result.json + +Network +------- + +``vcenter_vm_guest_networking_info`` will return the OS network configuration. + +.. literalinclude:: task_outputs/Get_guest_networking_information.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Get_guest_networking_information.result.json + +Network interfaces +------------------ + +``vcenter_vm_guest_networking_interfaces_info`` will return a list of NIC configurations. + +See also :ref:`vmware_rest_attach_a_network`. + +.. literalinclude:: task_outputs/Get_guest_network_interfaces_information.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Get_guest_network_interfaces_information.result.json + +Network routes +-------------- + +Use ``vcenter_vm_guest_networking_routes_info`` to explore the route table of your vitual machine. + +.. literalinclude:: task_outputs/Get_guest_network_routes_information.task.yaml + +Result +______ + +.. literalinclude:: task_outputs/Get_guest_network_routes_information.result.json +