Coder Social home page Coder Social logo

ansible-collections / vmware.vmware_rest Goto Github PK

View Code? Open in Web Editor NEW
126.0 18.0 56.0 4.17 MB

Ansible Collection for VMWare (REST modules)

License: GNU General Public License v3.0

Python 99.52% Shell 0.44% Makefile 0.04%
rest-api rest python python3 vmware vsphere vsphere-sdk ansible ansible-collection open-source

vmware.vmware_rest's Introduction

Ansible Collection: vmware.vmware_rest

This repo hosts the vmware.vmware_rest Ansible Collection.

The collection includes the VMware modules and plugins supported by Ansible VMware community to help the management of VMware infrastructure. These modules are different from community.vmware since they are based upon VMware vSphere REST API interface and not relying on any third party libraries such as Pyvmomi and vSphere Automation SDK for Python.

Ansible version compatibility

This collection has been tested against following Ansible versions: >=2.14.0.

For collections that support Ansible 2.9, please ensure you update your network_os to use the fully qualified collection name (for example, cisco.ios.ios). Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible.

Python version compatibility

The collection depends on aiohttp has requirement which requires Python 3.6 or greater. Moreover, ansible version >=2.14 supports Python 3.9 or later.

vSphere compatibility

The 3.0.0 version of this collection requires vSphere 7.0.3 or greater.

Known limitations

VM Template and folder structure

These modules are based on the vSphere REST API. This API doesn't provide any mechanism to list or clone VM templates when they are stored in a VM folder. To circumvent this limitation, you should store your VM templates in a Content Library.

Installation and Usage

Install the dependencies

You can either install aiohttp using your OS package manager or using Python virtual environment.

Notes: For RHEL, there is no python3-aiohttp package available (yet), you can either get it from EPEL or install aiohttp using pip.

Installing the Collection from Ansible Galaxy

Before using the VMware collection, you need to install the collection with the ansible-galaxy CLI:

ansible-galaxy collection install vmware.vmware_rest

You can also include it in a requirements.yml file and install it via ansible-galaxy collection install -r requirements.yml using the format:

collections:
- name: vmware.vmware_rest

Content

Lookup plugins

Name Description
vmware.vmware_rest.cluster_moid Look up MoID for vSphere cluster objects using vCenter REST API
vmware.vmware_rest.datacenter_moid Look up MoID for vSphere datacenter objects using vCenter REST API
vmware.vmware_rest.datastore_moid Look up MoID for vSphere datastore objects using vCenter REST API
vmware.vmware_rest.folder_moid Look up MoID for vSphere folder objects using vCenter REST API
vmware.vmware_rest.host_moid Look up MoID for vSphere host objects using vCenter REST API
vmware.vmware_rest.network_moid Look up MoID for vSphere network objects using vCenter REST API
vmware.vmware_rest.resource_pool_moid Look up MoID for vSphere resource pool objects using vCenter REST API
vmware.vmware_rest.vm_moid Look up MoID for vSphere vm objects using vCenter REST API

Modules

Name Description
vmware.vmware_rest.appliance_access_consolecli Set enabled state of the console-based controlled CLI (TTY1).
vmware.vmware_rest.appliance_access_consolecli_info Get enabled state of the console-based controlled CLI (TTY1).
vmware.vmware_rest.appliance_access_dcui Set enabled state of Direct Console User Interface (DCUI TTY2).
vmware.vmware_rest.appliance_access_dcui_info Get enabled state of Direct Console User Interface (DCUI TTY2).
vmware.vmware_rest.appliance_access_shell Set enabled state of BASH, that is, access to BASH from within the controlled CLI.
vmware.vmware_rest.appliance_access_shell_info Get enabled state of BASH, that is, access to BASH from within the controlled CLI.
vmware.vmware_rest.appliance_access_ssh Set enabled state of the SSH-based controlled CLI.
vmware.vmware_rest.appliance_access_ssh_info Get enabled state of the SSH-based controlled CLI.
vmware.vmware_rest.appliance_health_applmgmt_info Get health status of applmgmt services.
vmware.vmware_rest.appliance_health_database_info Returns the health status of the database.
vmware.vmware_rest.appliance_health_databasestorage_info Get database storage health.
vmware.vmware_rest.appliance_health_load_info Get load health.
vmware.vmware_rest.appliance_health_mem_info Get memory health.
vmware.vmware_rest.appliance_health_softwarepackages_info Get information on available software updates available in the remote vSphere Update Manager repository
vmware.vmware_rest.appliance_health_storage_info Get storage health.
vmware.vmware_rest.appliance_health_swap_info Get swap health.
vmware.vmware_rest.appliance_health_system_info Get overall health of system.
vmware.vmware_rest.appliance_infraprofile_configs Exports the desired profile specification.
vmware.vmware_rest.appliance_infraprofile_configs_info List all the profiles which are registered.
vmware.vmware_rest.appliance_localaccounts_globalpolicy Set the global password policy.
vmware.vmware_rest.appliance_localaccounts_globalpolicy_info Get the global password policy.
vmware.vmware_rest.appliance_localaccounts_info Get the local user account information.
vmware.vmware_rest.appliance_monitoring_info Get monitored item info
vmware.vmware_rest.appliance_monitoring_query Get monitoring data.
vmware.vmware_rest.appliance_networking Reset and restarts network configuration on all interfaces, also this will renew the DHCP lease for DHCP IP address.
vmware.vmware_rest.appliance_networking_dns_domains Set DNS search domains.
vmware.vmware_rest.appliance_networking_dns_domains_info Get list of DNS search domains.
vmware.vmware_rest.appliance_networking_dns_hostname Set the Fully Qualified Domain Name.
vmware.vmware_rest.appliance_networking_dns_hostname_info Get the Fully Qualified Doman Name.
vmware.vmware_rest.appliance_networking_dns_servers Set the DNS server configuration
vmware.vmware_rest.appliance_networking_dns_servers_info Get DNS server configuration.
vmware.vmware_rest.appliance_networking_firewall_inbound Set the ordered list of firewall rules to allow or deny traffic from one or more incoming IP addresses
vmware.vmware_rest.appliance_networking_firewall_inbound_info Get the ordered list of firewall rules
vmware.vmware_rest.appliance_networking_info Get Networking information for all configured interfaces.
vmware.vmware_rest.appliance_networking_interfaces_info Get information about a particular network interface.
vmware.vmware_rest.appliance_networking_interfaces_ipv4 Set IPv4 network configuration for specific network interface.
vmware.vmware_rest.appliance_networking_interfaces_ipv4_info Get IPv4 network configuration for specific NIC.
vmware.vmware_rest.appliance_networking_interfaces_ipv6 Set IPv6 network configuration for specific interface.
vmware.vmware_rest.appliance_networking_interfaces_ipv6_info Get IPv6 network configuration for specific interface.
vmware.vmware_rest.appliance_networking_noproxy Sets servers for which no proxy configuration should be applied
vmware.vmware_rest.appliance_networking_noproxy_info Returns servers for which no proxy configuration will be applied.
vmware.vmware_rest.appliance_networking_proxy Configures which proxy server to use for the specified protocol
vmware.vmware_rest.appliance_networking_proxy_info Gets the proxy configuration for a specific protocol.
vmware.vmware_rest.appliance_ntp Set NTP servers
vmware.vmware_rest.appliance_ntp_info Get the NTP configuration status
vmware.vmware_rest.appliance_services Restarts a service
vmware.vmware_rest.appliance_services_info Returns the state of a service.
vmware.vmware_rest.appliance_shutdown Cancel pending shutdown action.
vmware.vmware_rest.appliance_shutdown_info Get details about the pending shutdown action.
vmware.vmware_rest.appliance_system_globalfips Enable/Disable Global FIPS mode for the appliance
vmware.vmware_rest.appliance_system_globalfips_info Get current appliance FIPS settings.
vmware.vmware_rest.appliance_system_storage Resize all partitions to 100 percent of disk size.
vmware.vmware_rest.appliance_system_storage_info Get disk to partition mapping.
vmware.vmware_rest.appliance_system_time_info Get system time.
vmware.vmware_rest.appliance_system_time_timezone Set time zone.
vmware.vmware_rest.appliance_system_time_timezone_info Get time zone.
vmware.vmware_rest.appliance_system_version_info Get the version.
vmware.vmware_rest.appliance_timesync Set time synchronization mode.
vmware.vmware_rest.appliance_timesync_info Get time synchronization mode.
vmware.vmware_rest.appliance_update_info Gets the current status of the appliance update.
vmware.vmware_rest.appliance_vmon_service Lists details of services managed by vMon.
vmware.vmware_rest.appliance_vmon_service_info Returns the state of a service.
vmware.vmware_rest.content_configuration Updates the configuration
vmware.vmware_rest.content_configuration_info Retrieves the current configuration values.
vmware.vmware_rest.content_library_item_info Returns the {@link ItemModel} with the given identifier.
vmware.vmware_rest.content_locallibrary Creates a new local library.
vmware.vmware_rest.content_locallibrary_info Returns a given local library.
vmware.vmware_rest.content_subscribedlibrary Creates a new subscribed library
vmware.vmware_rest.content_subscribedlibrary_info Returns a given subscribed library.
vmware.vmware_rest.vcenter_cluster_info Retrieves information about the cluster corresponding to cluster.
vmware.vmware_rest.vcenter_datacenter Create a new datacenter in the vCenter inventory
vmware.vmware_rest.vcenter_datacenter_info Retrieves information about the datacenter corresponding to datacenter.
vmware.vmware_rest.vcenter_datastore_info Retrieves information about the datastore indicated by datastore.
vmware.vmware_rest.vcenter_folder_info Returns information about at most 1000 visible (subject to permission checks) folders in vCenter matching the Folder.FilterSpec.
vmware.vmware_rest.vcenter_host Add a new standalone host in the vCenter inventory
vmware.vmware_rest.vcenter_host_info Returns information about at most 2500 visible (subject to permission checks) hosts in vCenter matching the Host.FilterSpec.
vmware.vmware_rest.vcenter_network_info Returns information about at most 1000 visible (subject to permission checks) networks in vCenter matching the Network.FilterSpec.
vmware.vmware_rest.vcenter_ovf_libraryitem Creates a library item in content library from a virtual machine or virtual appliance
vmware.vmware_rest.vcenter_resourcepool Creates a resource pool.
vmware.vmware_rest.vcenter_resourcepool_info Retrieves information about the resource pool indicated by resourcePool.
vmware.vmware_rest.vcenter_storage_policies_info Returns information about at most 1024 visible (subject to permission checks) storage solicies availabe in vCenter
vmware.vmware_rest.vcenter_vm Creates a virtual machine.
vmware.vmware_rest.vcenter_vm_guest_customization Applies a customization specification on the virtual machine
vmware.vmware_rest.vcenter_vm_guest_filesystem_directories Creates a directory in the guest operating system
vmware.vmware_rest.vcenter_vm_guest_identity_info Return information about the guest.
vmware.vmware_rest.vcenter_vm_guest_localfilesystem_info Returns details of the local file systems in the guest operating system.
vmware.vmware_rest.vcenter_vm_guest_networking_info Returns information about the network configuration in the guest operating system.
vmware.vmware_rest.vcenter_vm_guest_networking_interfaces_info Returns information about the networking interfaces in the guest operating system.
vmware.vmware_rest.vcenter_vm_guest_networking_routes_info Returns information about network routing in the guest operating system.
vmware.vmware_rest.vcenter_vm_guest_operations_info Get information about the guest operation status.
vmware.vmware_rest.vcenter_vm_guest_power Issues a request to the guest operating system asking it to perform a soft shutdown, standby (suspend) or soft reboot
vmware.vmware_rest.vcenter_vm_guest_power_info Returns information about the guest operating system power state.
vmware.vmware_rest.vcenter_vm_hardware Updates the virtual hardware settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_adapter_sata Adds a virtual SATA adapter to the virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_adapter_sata_info Returns information about a virtual SATA adapter.
vmware.vmware_rest.vcenter_vm_hardware_adapter_scsi Adds a virtual SCSI adapter to the virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_adapter_scsi_info Returns information about a virtual SCSI adapter.
vmware.vmware_rest.vcenter_vm_hardware_boot Updates the boot-related settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_boot_device Sets the virtual devices that will be used to boot the virtual machine
vmware.vmware_rest.vcenter_vm_hardware_boot_device_info Returns an ordered list of boot devices for the virtual machine
vmware.vmware_rest.vcenter_vm_hardware_boot_info Returns the boot-related settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_cdrom Adds a virtual CD-ROM device to the virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_cdrom_info Returns information about a virtual CD-ROM device.
vmware.vmware_rest.vcenter_vm_hardware_cpu Updates the CPU-related settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_cpu_info Returns the CPU-related settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_disk Adds a virtual disk to the virtual machine
vmware.vmware_rest.vcenter_vm_hardware_disk_info Returns information about a virtual disk.
vmware.vmware_rest.vcenter_vm_hardware_ethernet Adds a virtual Ethernet adapter to the virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_ethernet_info Returns information about a virtual Ethernet adapter.
vmware.vmware_rest.vcenter_vm_hardware_floppy Adds a virtual floppy drive to the virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_floppy_info Returns information about a virtual floppy drive.
vmware.vmware_rest.vcenter_vm_hardware_info Returns the virtual hardware settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_memory Updates the memory-related settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_memory_info Returns the memory-related settings of a virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_parallel Adds a virtual parallel port to the virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_parallel_info Returns information about a virtual parallel port.
vmware.vmware_rest.vcenter_vm_hardware_serial Adds a virtual serial port to the virtual machine.
vmware.vmware_rest.vcenter_vm_hardware_serial_info Returns information about a virtual serial port.
vmware.vmware_rest.vcenter_vm_info Returns information about a virtual machine.
vmware.vmware_rest.vcenter_vm_libraryitem_info Returns the information about the library item associated with the virtual machine.
vmware.vmware_rest.vcenter_vm_power Operate a boot, hard shutdown, hard reset or hard suspend on a guest.
vmware.vmware_rest.vcenter_vm_power_info Returns the power state information of a virtual machine.
vmware.vmware_rest.vcenter_vm_storage_policy Updates the storage policy configuration of a virtual machine and/or its associated virtual hard disks.
vmware.vmware_rest.vcenter_vm_storage_policy_compliance Returns the storage policy Compliance Compliance.Info of a virtual machine after explicitly re-computing compliance check.
vmware.vmware_rest.vcenter_vm_storage_policy_compliance_info Returns the cached storage policy compliance information of a virtual machine.
vmware.vmware_rest.vcenter_vm_storage_policy_info Returns Information about Storage Policy associated with a virtual machine's home directory and/or its virtual hard disks.
vmware.vmware_rest.vcenter_vm_tools Update the properties of VMware Tools.
vmware.vmware_rest.vcenter_vm_tools_info Get the properties of VMware Tools.
vmware.vmware_rest.vcenter_vm_tools_installer Connects the VMware Tools CD installer as a CD-ROM for the guest operating system
vmware.vmware_rest.vcenter_vm_tools_installer_info Get information about the VMware Tools installer.
vmware.vmware_rest.vcenter_vmtemplate_libraryitems Creates a library item in content library from a virtual machine
vmware.vmware_rest.vcenter_vmtemplate_libraryitems_info Returns information about a virtual machine template contained in the library item specified by {@param.name templateLibraryItem}

Documentation

The VMware REST modules guide gives a step by step introduction of the collection.

Development

This collection can be generated using the content_builder tool. Please refer to the vmware module generation.

Release notes

See CHANGELOG.rst.

Releasing, Versioning and Deprecation

This collection follows Semantic Versioning. More details on versioning can be found in the Ansible docs.

We plan to regularly release new minor or bugfix versions once new features or bugfixes have been implemented.

Releasing the current major version happens from the main branch.

We currently are not planning any deprecations or new major releases like 2.0.0 containing backwards incompatible changes. If backwards incompatible changes are needed, we plan to deprecate the old behavior as early as possible. We also plan to backport at least bugfixes for the old major version for some time after releasing a new major version. We will not block community members from backporting other bugfixes and features from the latest stable version to older release branches, under the condition that these backports are of reasonable quality.

Communication

We have a dedicated Working Group for VMware. You can find other people interested in this in #ansible-vmware on libera.chat IRC. For more information about communities, meetings and agendas see https://github.com/ansible/community/wiki/VMware.

Code of Conduct

This repository adheres to the Ansible Community code of conduct

More information

License

GNU General Public License v3.0 or later

See LICENSE to see the full text.

vmware.vmware_rest's People

Contributors

abikouo avatar akasurde avatar akira6592 avatar alinabuzachis avatar andersson007 avatar ansible-zuul[bot] avatar bardielle avatar bcoca avatar cleif avatar ephracis avatar gomathiselvis avatar goneri avatar hakbailey avatar jillr avatar mandar242 avatar mariolenz avatar nicolastalvasson avatar pabelanger avatar pugnacity avatar sean-m-sullivan avatar sky-joker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vmware.vmware_rest's Issues

vcenter_host_info parameter aliases to old name to prevent breaking changes

SUMMARY

In previous versions of the collection, the vcenter_host_info module had parameters that start with the name filter_ such as filter_cluster as shown in this previous commit:
https://github.com/ansible-collections/vmware.vmware_rest/blob/451fab188f2b9572d998ce5d4d914ae121c632d4/docs/vmware.vmware_rest.vcenter_host_info_module.rst

In the current 2.0 version, these parameters have been renamed to remove the filter_ prefix so filter_cluster: is now just cluster: which breaks any existing playbooks that utilised these parameters.
https://github.com/ansible-collections/vmware.vmware_rest/blob/main/docs/vmware.vmware_rest.vcenter_host_info_module.rst

Adding aliases for these old parameter names would allow for smoother upgrades to the new collection version

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vcenter_host_info

ADDITIONAL INFORMATION

`.` in some option names

Some arguments have got a . their name:

ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.clusters' in argument_spec is not a valid python identifier
ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.datacenters' in argument_spec is not a valid python identifier
ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.folders' in argument_spec is not a valid python identifier
ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.hosts' in argument_spec is not a valid python identifier
ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.names' in argument_spec is not a valid python identifier
ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.power_states' in argument_spec is not a valid python identifier
ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.resource_pools' in argument_spec is not a valid python identifier
ERROR: plugins/modules/vcenter_vm_info.py:0:0: parameter-invalid: Argument 'filter.vms' in argument_spec is not a valid python identifier

vcenter_vm fails on vCenter 7.0.1

SUMMARY

vcenter_vm fails to create vm using following task on vCenter 7.0.1 version

    - name: Create a VM
      vmware.vmware_rest.vcenter_vm:
        placement:
          datastore: '{{ datastore_id }}'
          folder: '{{ folder_id }}'
          resource_pool: '{{ resource_pool_id }}'
        name: test_vm1
        guest_OS: DEBIAN_8_64
        hardware_version: VMX_11
        memory:
          hot_add_enabled: true
          size_MiB: 1024
      register: _result
ISSUE TYPE
  • Bug Report
COMPONENT NAME

vcenter_vm

ANSIBLE VERSION
devel
CONFIGURATION
vcenter 7.0.1
OS / ENVIRONMENT

MacOS

STEPS TO REPRODUCE

As per above

EXPECTED RESULTS

VM should get created.

ACTUAL RESULTS
fatal: [localhost]: FAILED! => {"_debug_info": {"operation": "create", "status": 400}, "changed": false, "type": "com.vmware.vapi.std.errors.invalid_argument", "value": {"error_type": "INVALID_ARGUMENT", "messages": []}}

rename repo to ansible.vmware_rest

SUMMARY

Hi, can we please rename the repo to be consistent with others under gh/anisble-collections?

GitHub will maintain redirects. Once done we should review README and galaxy.yml

modules to work with templates

SUMMARY

There currently are no modules to work with templates

  • create a vm from a template
  • create a template from a vm
ISSUE TYPE
  • Feature Idea
COMPONENT NAME
ADDITIONAL INFORMATION

vmware_rest modules don't work when it not install cloud.common

SUMMARY

I tried vmware_rest module the following error occurs when not install cloud.common collection.

fatal: [localhost]: FAILED! => {"msg": "error processing module_util ansible_collections.cloud.common.plugins.module_utils.turbo.module.AnsibleTurboModule loading redirected collection cloud.common: unable to locate collection cloud.common"}

I'm looking like the vmware_rest modules to work even if the cloud.common not installed.
For example, the following code is vcenter_datacenter_info a part.

(snip)
try:
    from ansible_collections.cloud.common.plugins.module_utils.turbo.module import (
        AnsibleTurboModule as AnsibleModule,
    )
except ImportError:
    from ansible.module_utils.basic import AnsibleModule
(snip)

Is cloud.common required for the vmware_rest modules to work?

ISSUE TYPE
  • Bug Report
COMPONENT NAME

plugins/modules/vcenter_datacenter_info

ANSIBLE VERSION
# ansible --version
ansible 2.10.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/vmware_rest/venv/lib64/python3.6/site-packages/ansible
  executable location = /root/vmware_rest/venv/bin/ansible
  python version = 3.6.8 (default, Aug  7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
# ansible-config dump --only-changed
OS / ENVIRONMENT
# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
STEPS TO REPRODUCE

I executed the following playbook.

---
- name: Test Playbook
  hosts: localhost
  gather_facts: no
  collections:
    - vmware.vmware_rest
  tasks:
    - name: Gather info for datacenter
      vcenter_datacenter_info:
        vcenter_hostname: "{{ vcenter_hostname }}"
        vcenter_username: "{{ vcenter_username }}"
        vcenter_password: "{{ vcenter_password }}"
        vcenter_certs: false
EXPECTED RESULTS

Even if not install cloud.common the vmware_rest is to work.

ACTUAL RESULTS

The cloud.common error occurs

Is "content_library_item" module is missing?

I am able to create content library. But there is no module to create "content_library_item"

I can see content_library_item is refered as M(content_library_item) or <** class="module"> content_library_item</**> in documentation. but idont see corresponding module.

Once the library is created, what is the way to upload ovf/iso into the library?

vcenter_vm_power_info does not mention state option, vm identifier should be vm moid.

SUMMARY

Hello,
The vcenter_vm_power_info has no entry for the state option.
The vm option suggests that there is a state option (Required with state=['get'] )

Also the vm option should not use the word identifier.
identifier suggest uuid or name, but the moid of the vm is needed here

Rob

ISSUE TYPE
  • Documentation Report
COMPONENT NAME
ANSIBLE VERSION

Cannot create a resource pool following current documentation

SUMMARY

Cannot create a resource pool following current documentation

From what I gather, I need to provide the name of the new resource pool and it's parent. This is an accordance with all documented parameters which state Required with state=['present']

My choice of parent comes from viewing the vcenter UI via Hosts and Clusters. Within the playbook below I retrieve the moid of the cluster I want to create the resource pool under (the cluster name was already set where I am running the playbook via the env var GOVC_CLUSTER so I just reuse that to filter on)

So far I have

- name: Create resource pool
  hosts: localhost
  vars:
    existing_cluster: "{{ lookup('env', 'GOVC_CLUSTER') }}"

  collections:
  - vmware.vmware_rest
  tasks:
  - name: "get parent cluster for resource pool"
    vcenter_cluster_info:
      filter_names:
      - "{{ existing_cluster }}"
    register: my_cluster
  - name: "ensure resource pool created"
    vcenter_resourcepool:
      name: "new-resource-pool"
      parent: "{{ my_cluster.value[0].cluster }}"
    register: my_resource_pool
  - debug: msg="{{ my_resource_pool }}"

but this results in

fatal: [localhost]: FAILED! => {
    "_debug_info": {
        "operation": "create",
        "status": 404
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "cpu_allocation": null,
            "memory_allocation": null,
            "name": "new-resource-pool",
            "parent": "domain-c2050",
            "resource_pool": null,
            "state": "present",
            "vcenter_hostname": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "vcenter_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "vcenter_rest_log_file": null,
            "vcenter_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "vcenter_validate_certs": false
        }
    },
    "type": "com.vmware.vapi.std.errors.not_found",
    "value": {
        "error_type": "NOT_FOUND",
        "messages": [
            {
                "args": [],
                "default_message": "Resource pool with identifier '{}' does not exist.",
                "id": "com.vmware.api.vcenter.resourcepool.not_found"
            }
        ]
    }
}

Why would it error stating the obvious that the resource pool does not exist when to me I'm clearly trying to "create" it as indicated by "state": "present"?

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

vmware.vmware_rest.vcenter_resourcepool_module.rst

ANSIBLE VERSION
ansible 2.10.2
  config file = None
  configured module search path = ['/home/ubuntu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ubuntu/.local/lib/python3.6/site-packages/ansible
  executable location = /home/ubuntu/.local/bin/ansible
  python version = 3.6.9 (default, Oct  8 2020, 12:12:24) [GCC 8.4.0]

Wrong endpoint?

SUMMARY

Attempt to get vmware.vmware_rest.vcenter_datacenter_info from example is not working
Vcenter API explorer suggests /rest/vcenter/datacenter instead of /api/vcenter/datacenter used in module.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware.vmware_rest.vcenter_datacenter_info
Probably vmware.vmware_rest.vcenter_datacenter has the same issue, at least grep shows the same path in ./plugins/modules/vcenter_datacenter.py

ANSIBLE VERSION
ansible 2.9.16
  config file = /home/user/.ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
COLLECTION VERSION
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')
~$ grep version /home/user/.ansible/collections/ansible_collections/vmware/vmware_rest/MANIFEST.json
  "version": "2.0.0",
CONFIGURATION
ANSIBLE_PIPELINING(/home/user/.ansible.cfg) = True
HOST_KEY_CHECKING(/home/user/.ansible.cfg) = False
OS / ENVIRONMENT

vSphere version 6.7.0.48000

STEPS TO REPRODUCE

ansible-playbook -i test, ./vmware_rest_get_mac.yml -vvvvvv

---
- hosts: all
  gather_facts: no

  vars_prompt:
  - name: vcenter_username
    prompt: "Enter vcenter_username"
    private: no

  - name: vcenter_password
    prompt: "Enter vcenter_password"
    unsafe: yes
    private: yes


  tasks:
    - name: Get My vCenter
      vmware.vmware_rest.vcenter_datacenter_info:
        vcenter_username: "{{vcenter_username}}"
        vcenter_password: "{{vcenter_password}}"
        vcenter_hostname: vcenter003.atl.example.com
        vcenter_validate_certs: no
        vcenter_rest_log_file: /tmp/vmware_rest
      register: r
      delegate_to: localhost

    - debug:
        var: r
EXPECTED RESULTS

Succesfull execution.

ACTUAL RESULTS

Ansible output:

fatal: [test]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "datacenter": null,
            "datacenters": null,
            "folders": null,
            "names": null,
            "vcenter_hostname": "vcenter003.atl.example.com",
            "vcenter_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "vcenter_rest_log_file": null,
            "vcenter_username": "[email protected]",
            "vcenter_validate_certs": false
        }
    },
    "msg": [
        "  File \"/usr/lib/python3.7/runpy.py\", line 193, in _run_module_as_main\n    \"__main__\", mod_spec)\n",
        "  File \"/usr/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n",
        "  File \"/tmp/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload_uze5hog6/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 352, in <module>\n",                                                                                                                        
        "  File \"/tmp/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload_uze5hog6/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 329, in start\n",                                                                                                                           
        "  File \"/usr/lib/python3.7/asyncio/base_events.py\", line 539, in run_forever\n    self._run_once()\n",
        "  File \"/usr/lib/python3.7/asyncio/base_events.py\", line 1775, in _run_once\n    handle._run()\n",
        "  File \"/usr/lib/python3.7/asyncio/events.py\", line 88, in _run\n    self._context.run(self._callback, *self._args)\n",
        "  File \"/tmp/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload_uze5hog6/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 290, in handle\n",                                                                                                                          
        "Traceback (most recent call last):\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload_uze5hog6/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 173, in run\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload_uze5hog6/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_datacenter_info.py\", line 220, in main\n    result = await entry_point(module, session)\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload_uze5hog6/ansible_vmware.vmware_rest.vcenter_datacenter_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_datacenter_info.py\", line 242, in entry_point\n    _json = await resp.json()\n  File \"/usr/lib/python3/dist-packages/aiohttp/client_reqrep.py\", line 1001, in json\n    headers=self.headers)\naiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=iso-8859-1'\n"                                                                                                                                                                                        
    ]
}

Content of rest_log:

POST: https://vcenter003.atl.example.com/rest/com/vmware/cis/session
headers: <CIMultiDict()>
  status: 200
  answer: {"value":"fcbe3e2d663d207a65249dbd295db916"}

GET: https://vcenter003.atl.example.com/api/vcenter/datacenter
headers: <CIMultiDict('vmware-api-session-id': 'fcbe3e2d663d207a65249dbd295db916', 'content-type': 'application/json')>
  status: 405
  answer: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 405 HTTP method GET is not supported by this URL</title>
</head>
<body><h2>HTTP ERROR 405 HTTP method GET is not supported by this URL</h2>
<table>
<tr><th>URI:</th><td>/api/vcenter/datacenter</td></tr>
<tr><th>STATUS:</th><td>405</td></tr>
<tr><th>MESSAGE:</th><td>HTTP method GET is not supported by this URL</td></tr>
<tr><th>SERVLET:</th><td>servlet 3</td></tr>
</table>

</body>
</html>

review the module documentation

<-- find plugins/modules -name '*.py'|xargs -n1 basename -s .py|xargs -n1 echo "- [ ]" -->

  • vcenter_vm_storage_policy_info
  • vcenter_vm_guest_localfilesystem_info
  • vcenter_network_info
  • vcenter_vm_storage_policy_compliance_info
  • vcenter_vm_hardware_cdrom
  • vcenter_vm_hardware_parallel
  • vcenter_vm_hardware_cdrom_info
  • vcenter_vm_hardware_serial_info
  • vcenter_vm_libraryitem_info
  • vcenter_vm_tools_info
  • vcenter_storage_policies
  • vcenter_vm_guest_networking_routes_info
  • vcenter_vm_hardware_info
  • vcenter_vm_hardware_adapter_scsi_info
  • vcenter_vm_hardware_boot_device_info
  • vcenter_vm_hardware_boot_info
  • vcenter_vm_power
  • vcenter_storage_policies_entities_compliance_info
  • vcenter_vm_hardware
  • vcenter_vm
  • vcenter_vm_hardware_adapter_sata_info
  • vcenter_vm_hardware_parallel_info
  • vcenter_vm_info
  • vcenter_cluster_info
  • vcenter_datastore_info
  • vcenter_folder_info
  • vcenter_vm_hardware_cpu_info
  • vcenter_vm_hardware_disk_info
  • vcenter_vm_hardware_adapter_sata
  • vcenter_vm_hardware_cpu
  • vcenter_vm_hardware_ethernet
  • vcenter_vm_guest_networking_info
  • vcenter_vm_hardware_boot_device
  • vcenter_host
  • vcenter_vm_hardware_adapter_scsi
  • vcenter_vm_hardware_boot
  • vcenter_vm_hardware_disk
  • vcenter_vm_tools
  • vcenter_vm_power_info
  • vcenter_storage_policies_info
  • vcenter_datacenter_info
  • vcenter_vm_storage_policy
  • vcenter_vm_hardware_floppy
  • vcenter_vm_guest_identity_info
  • vcenter_storage_policies_vm_info
  • vcenter_vm_hardware_serial
  • vcenter_vm_hardware_ethernet_info
  • vcenter_vm_hardware_floppy_info
  • vcenter_host_connect
  • vcenter_host_disconnect
  • vcenter_host_info
  • vcenter_storage_policies_compliance_vm_info
  • vcenter_datacenter
  • vcenter_vm_hardware_memory_info
  • vcenter_vm_hardware_memory
  • vcenter_vm_guest_networking_interfaces_info

Examples for VMware REST modules

SUMMARY

Hello,
There is no working example for this module.

I've been told this is a replacement for httpapi
Is this a new connection type ?, if so a working usage example would be appreciated.

Rob

ISSUE TYPE
  • Documentation Report
COMPONENT NAME
ANSIBLE VERSION

Unable to find template using vcenter_vm_info

SUMMARY

I have a VM template and if I want to get moid using vcenter_vm_info module. The module returns nothing.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vcenter_vm_info

ANSIBLE VERSION
Ansible 2.11 devel
CONFIGURATION

OS / ENVIRONMENT

macOS

STEPS TO REPRODUCE
---
- hosts: localhost
  tasks:
    - name: Get VM template
      vmware.vmware_rest.vcenter_vm_info:
        filter_names:
          - xd
      register: r

    - debug:
        msg: "{{ r.value[0].vm }}"
EXPECTED RESULTS
ACTUAL RESULTS

should return information about the vm template or add a note in as a caveat.

TASK [Get VM template] *********************************************************************************
task path: /Volumes/data/src/playbooks/vmware/REST/get_vm.yml:4
ok: [localhost] => {"_debug_info": {"operation": "get", "status": 200}, "changed": false, "value": []}

TASK [debug] **********************************************************************************
task path: /Volumes/data/src/playbooks/vmware/REST/get_vm.yml:14
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: list object has no element 0\n\nThe error appears to be in '/Volumes/data/src/playbooks/vmware/REST/get_vm.yml': line 14, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - debug:\n      ^ here\n"}

Unable to create VM using vcenter_vm with latest changes

SUMMARY

I am trying to create a VM using vcenter_vm

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vcenter_vm

ANSIBLE VERSION
2.9.13
CONFIGURATION

Nothing specific

OS / ENVIRONMENT

CentOS 7

STEPS TO REPRODUCE
    - set_fact:
        cluster_id: "domain-c7"
        resource_pool_id: "resgroup-8"
        folder_id: "group-v22"
        datastore_id: "datastore-12"

    - name: Create a VM
      vmware.vmware_rest.vcenter_vm:
        vcenter_username: [email protected]
        vcenter_password: Esxi@123$%
        vcenter_hostname: 10.65.201.177
        placement:
          cluster: '{{ cluster_id }}'
          datastore: '{{ datastore_id }}'
          folder: '{{ folder_id }}'
          resource_pool: '{{ resource_pool_id }}'
        name: test_vm1
        guest_OS: DEBIAN_8_64
        hardware_version: VMX_11
        state: present
        memory:
          hot_add_enabled: true
          size_MiB: 1024
EXPECTED RESULTS

New VM should be created.

ACTUAL RESULTS
TASK [set_fact] *******************************************************************************
task path: /home/vagrant/create_vm.yml:71
ok: [localhost] => {"ansible_facts": {"cluster_id": "domain-c7", "datastore_id": "datastore-12", "folder_id": "group-v22", "resource_pool_id": "resgroup-8"}, "changed": false}

TASK [Create a VM] ****************************************************************************
task path: /home/vagrant/create_vm.yml:77
ok: [localhost] => {"_debug_info": {"operation": "get", "status": 200}, "changed": false, "id": "vm-15", "value": {"boot": {"delay": 0, "enter_setup_mode": false, "retry": false, "retry_delay": 10000, "type": "BIOS"}, "boot_devices": [], "cdroms": [{"key": "3000", "value": {"allow_guest_control": true, "backing": {"device_access_type": "PASSTHRU", "type": "CLIENT_DEVICE"}, "ide": {"master": true, "primary": true}, "label": "CD/DVD drive 1", "start_connected": false, "state": "NOT_CONNECTED", "type": "IDE"}}], "cpu": {"cores_per_socket": 1, "count": 1, "hot_add_enabled": false, "hot_remove_enabled": false}, "disks": [{"key": "2000", "value": {"backing": {"type": "VMDK_FILE", "vmdk_file": "[ds_171_2] debian_empty/debian_empty.vmdk"}, "capacity": 536870912, "label": "Hard disk 1", "scsi": {"bus": 0, "unit": 0}, "type": "SCSI"}}], "floppies": [], "guest_OS": "DEBIAN_9_64", "hardware": {"upgrade_policy": "NEVER", "upgrade_status": "NONE", "version": "VMX_13"}, "memory": {"hot_add_enabled": false, "size_MiB": 512}, "name": "debian_empty", "nics": [{"key": "4000", "value": {"allow_guest_control": true, "backing": {"network": "network-13", "network_name": "VM Network", "type": "STANDARD_PORTGROUP"}, "label": "Network adapter 1", "mac_address": "00:50:56:86:1f:06", "mac_type": "ASSIGNED", "start_connected": true, "state": "NOT_CONNECTED", "type": "VMXNET3", "upt_compatibility_enabled": true, "wake_on_lan_enabled": true}}], "parallel_ports": [], "power_state": "POWERED_OFF", "sata_adapters": [], "scsi_adapters": [{"key": "1000", "value": {"label": "SCSI controller 0", "scsi": {"bus": 0, "unit": 7}, "sharing": "NONE", "type": "PVSCSI"}}], "serial_ports": []}}
META: ran handlers
META: ran handlers

It is pick up an existing VM called debian_empty which is first in the list of existing VMs.

no official redhat rpm for aiohttp

SUMMARY

Hi,
I just found this document

<frustration mode>

Since you are redhat.
aiohttp is vital for this project, this project is backed by redhat
Why is there only an epel package for aiohttp ?

Since redhat is so proud on selling this as the next big thing.
Please provide an official aiohttp rpm so rhel admins don't need to include the epel repos and get into very long discussions about it with support.

</frustration mode>

Now back to centos 😋

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
ADDITIONAL INFORMATION

MacOS - SSL verification fails with: unable to get local issuer certificate

SUMMARY

I am having problems where the vmware_rest modules won't run on my system. It works on someone else's system and I'd have to test it on another machine of mine.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vcenter_vm_info

ANSIBLE VERSION
(hubs-infrastructure) anthos-node-host [master●] % ansible --version
ansible 2.9.13
  config file = None
  configured module search path = ['/Users/kbreit/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/kbreit/.pyenv/versions/3.7.7/envs/hubs-infrastructure/lib/python3.7/site-packages/ansible
  executable location = /Users/kbreit/.pyenv/versions/hubs-infrastructure/bin/ansible
  python version = 3.7.7 (default, Apr 17 2020, 09:55:29) [Clang 11.0.0 (clang-1100.0.33.16)]
CONFIGURATION
DEFAULT_KEEP_REMOTE_FILES(env: ANSIBLE_KEEP_REMOTE_FILES) = True
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /Users/kbreit/pass.txt
OS / ENVIRONMENT

macOS 10.15, latest

STEPS TO REPRODUCE
    - name: Get all VMs
      vmware.vmware_rest.vcenter_vm_info:
        vcenter_hostname: hostnamehere
        vcenter_username: [email protected]
        vcenter_password: mypass
        vcenter_validate_certs: no
      register: existing_vms
      until: existing_vms is not failed
      delegate_to: localhost
EXPECTED RESULTS

It should work and return output

ACTUAL RESULTS
Using module file /Users/kbreit/.ansible/collections/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py
<localhost> PUT /Users/kbreit/.ansible/tmp/ansible-local-10358qp094r_6/tmpjnz0p7he TO /Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py
<localhost> EXEC /bin/sh -c 'chmod u+x /Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/ /Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py && sleep 0'
<localhost> EXEC /bin/sh -c '/Users/kbreit/.pyenv/versions/3.7.7/envs/hubs-infrastructure/bin/python3.7 /Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py", line 247, in <module>
    _ansiballz_main()
  File "/Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py", line 237, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py", line 108, in invoke_module
    runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_info', init_globals=None, run_name='__main__', alter_sys=True)
  File "/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py", line 425, in <module>
  File "/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py", line 366, in main
  File "/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 28, in __init__
  File "/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 70, in run_on_daemon
  File "/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py", line 61, in connect
FileNotFoundError: [Errno 2] No such file or directory
fatal: [vmware]: FAILED! => {
    "attempts": 3,
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py\", line 247, in <module>\n    _ansiballz_main()\n  File \"/Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py\", line 237, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/kbreit/.ansible/tmp/ansible-tmp-1603220877.142858-10389-225793521646905/AnsiballZ_vcenter_vm_info.py\", line 108, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.vmware.vmware_rest.plugins.modules.vcenter_vm_info', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py\", line 425, in <module>\n  File \"/Users/kbreit/.pyenv/versions/3.7.7/lib/python3.7/asyncio/base_events.py\", line 587, in run_until_complete\n    return future.result()\n  File \"/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py\", line 366, in main\n  File \"/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 28, in __init__\n  File \"/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 70, in run_on_daemon\n  File \"/var/folders/t5/gx_568vj4w958qgxx_hhklvc0000gn/T/ansible_vmware.vmware_rest.vcenter_vm_info_payload_c9k54e1w/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py\", line 61, in connect\nFileNotFoundError: [Errno 2] No such file or directory\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

upload/download/move files in datastore

SUMMARY

Create a module to manipulate files in a datastore.
ie

  • create a folder
  • delete a folder
  • rename/move a folder
  • upload a file
  • delete a file
  • rename/move a file
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vcenter_datastore_file

ADDITIONAL INFORMATION

for uploading files/images to the vcenter datastore
also renaming or moving of the file/dir to keep things clean

Getting 404 for all requests with 2.0.0 but 1.0.1 works fine

Are there some new steps required to use 2.0.0?

I'm running playbooks found in https://github.com/matthewcosgrove/lab-ops/tree/master/prereqs

Using 1.0.1, everything runs fine, as they always have done

Every request, after upgrading to 2.0.0 gives

headers: <CIMultiDict('vmware-api-session-id': '55c11e2d372391b8a406ccfed35d4126', 'content-type': 'application/json')>
  status: 404
  answer: {"error_type":"NOT_FOUND","messages":[{"args":[],"default_message":"Not found.","id":"com.vmware.vapi.rest.httpNotFound"}]}

the lookups mis a usefull working example

Hello,

I've been reading through all the new features of the vmware.wmware_rest collection and was pleasantly surprised to see that lookups have been added.

And really dissapointed after reading the docs.

Now they are easy enough to use in a static environment.
However when you have a more dynamic environment they are rather useless.
ie:
a hardcoded search path is nice for a static environment.

- name: lookup MoID of the object
  debug: msg="{{ lookup('vmware.vmware_rest.vm_moid', '/my_dc/host/my_cluster/esxi1.test/test_vm1', **connection_args) }}"

you need to find the path only once and you are done with it

can't you make it simply work with:

- name: lookup MoID of the object
  debug: msg="{{ lookup('vmware.vmware_rest.vm_moid', 'test_vm1', **connection_args) }}"

and while you are at it, make it respect environment args ?

- name: myplay
  environment:
     VMWARE_HOST: my_host
     VMWARE_USER: my_user
    etc etc
  tasks:
     - name: lookup MoID of the object
       debug: msg="{{ lookup('vmware.vmware_rest.vm_moid', 'test_vm1') }}"

and if all that already works, make this a bit more obvious in the docs

Rob

SUMMARY
ISSUE TYPE
  • Documentation Report
COMPONENT NAME
ANSIBLE VERSION

Connection Issue

SUMMARY

SSH connection failure - expected it to connect using the REST API instead of SSH.
Note: The SSH connection is successful with the community collection

ISSUE TYPE
  • Bug or no Bug Report
COMPONENT NAME
vmware.vmware_rest.vcenter_vm_info
ANSIBLE VERSION
2.9.11
CONFIGURATION


OS / ENVIRONMENT
  • vCenter 6.7
  • OS - CentOS 8
  • Ansible
  • AWX 14.1.0 in Docker
  • Git
STEPS TO REPRODUCE
  • Create playbook and push it out to the Git project repo
  • Create Center host inventory and push it to Git project repo
  • In AWX, sync Git project to avail both the playbook and inventory if not already synced automatically
  • In AWX, create vCenter host credentials
  • In AWX create a job template and specify the inventory name and playbook as well as credentials
  • Run play
---
- hosts: all
  # connection: ssh
  gather_facts: no

  vars: 
    vchost: "vc.mysite.com"

  tasks:

    - name: Collect information about a whdtst1
      vmware.vmware_rest.vcenter_vm_info:
        vcenter_hostname: "{{ vchost }}"
        vm: whdtst1
      tags: whdtst1_hardware_info

    - name: upgrade the VM hardware version
      vmware.vmware_rest.vcenter_vm_hardware:
        vcenter_hostname: "{{ vchost }}"
        upgrade_policy: AFTER_CLEAN_SHUTDOWN
        upgrade_version: VMX_14
        vm: whdtst1
      tags: whdtst1_ver
EXPECTED RESULTS

Establish a connection and run successfully

ACTUAL RESULTS
ansible-playbook 2.9.11
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /tmp/awx_14178_c2borjb4/tmpyp0cvpi_ as it did not pass its verify_file() method
Parsed /tmp/awx_14178_c2borjb4/tmpyp0cvpi_ inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks/awx_display.py
PLAYBOOK: upgrade_vm_hardware.yml **********************************************
Positional arguments: SYSOPS/upgrade_vm_hardware.yml
verbosity: 4
remote_user: root
connection: smart
timeout: 10
become_method: sudo
tags: ('whdtst1_hardware_info',)
inventory: ('/tmp/awx_14178_c2borjb4/tmpyp0cvpi_',)
extra_vars: ('@/tmp/awx_14178_c2borjb4/env/extravars',)
forks: 5
1 plays in SYSOPS/upgrade_vm_hardware.yml
PLAY [all] *********************************************************************
META: ran handlers
TASK [Collect information about a whdtst1] *************************************
task path: /tmp/awx_14178_c2borjb4/project/SYSOPS/upgrade_vm_hardware.yml:11
<vc.mysite.com> ESTABLISH SSH CONNECTION FOR USER: root
<vc.mysite.com> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/tmp/awx_14178_c2borjb4/cp/255e12357a vc.mysite.com '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<vc.mysite.com> (255, b'', b'OpenSSH_8.0p1, OpenSSL 1.1.1c FIPS  28 May 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 51: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf\r\ndebug2: checking match for \'final all\' host vc.mysite.com originally vc.mysite.com\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: not matched \'final\'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-gex-sha1-,gss-group14-sha1-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 51: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf\r\ndebug2: checking match for \'final all\' host vc.mysite.com originally vc.mysite.com\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: matched \'final\'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-gex-sha1-,gss-group14-sha1-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1]\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/tmp/awx_14178_c2borjb4/cp/255e12357a" does not exist\r\ndebug2: resolving "vc.mysite.com" port 22\r\ndebug2: ssh_connect_direct\r\ndebug1: Connecting to vc.mysite.com [10.200.200.10] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: fd 3 clearing O_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 9950 ms remain after connect\r\ndebug1: identity file /root/.ssh/id_rsa type -1\r\ndebug1: identity file /root/.ssh/id_rsa-cert type -1\r\ndebug1: identity file /root/.ssh/id_dsa type -1\r\ndebug1: identity file /root/.ssh/id_dsa-cert type -1\r\ndebug1: identity file /root/.ssh/id_ecdsa type -1\r\ndebug1: identity file /root/.ssh/id_ecdsa-cert type -1\r\ndebug1: identity file /root/.ssh/id_ed25519 type -1\r\ndebug1: identity file /root/.ssh/id_ed25519-cert type -1\r\ndebug1: identity file /root/.ssh/id_xmss type -1\r\ndebug1: identity file /root/.ssh/id_xmss-cert type -1\r\ndebug1: Local version string SSH-2.0-OpenSSH_8.0\r\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_7.4\r\ndebug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: Authenticating to vc.mysite.com:22 as \'root\'\r\ndebug3: hostkeys_foreach: reading file "/root/.ssh/known_hosts"\r\ndebug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:8\r\ndebug3: load_hostkeys: loaded 1 keys from vc.mysite.com\r\ndebug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\r\ndebug3: send packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT sent\r\ndebug3: receive packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT received\r\ndebug2: local client KEXINIT proposal\r\ndebug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,ext-info-c\r\ndebug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa\r\ndebug2: ciphers ctos: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc\r\ndebug2: ciphers stoc: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc\r\ndebug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512\r\ndebug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512\r\ndebug2: compression ctos: [email protected],zlib,none\r\ndebug2: compression stoc: [email protected],zlib,none\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug2: peer server KEXINIT proposal\r\ndebug2: KEX algorithms: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1\r\ndebug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519\r\ndebug2: ciphers ctos: [email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr\r\ndebug2: ciphers stoc: [email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr\r\ndebug2: MACs ctos: [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-sha1\r\ndebug2: MACs stoc: [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-sha1\r\ndebug2: compression ctos: none,[email protected]\r\ndebug2: compression stoc: none,[email protected]\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug1: kex: algorithm: ecdh-sha2-nistp256\r\ndebug1: kex: host key algorithm: ecdsa-sha2-nistp256\r\ndebug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: [email protected]\r\ndebug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: [email protected]\r\ndebug1: kex: ecdh-sha2-nistp256 need=32 dh_need=32\r\ndebug1: kex: ecdh-sha2-nistp256 need=32 dh_need=32\r\ndebug3: send packet: type 30\r\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\r\ndebug3: receive packet: type 31\r\ndebug1: Server host key: ecdsa-sha2-nistp256 SHA256:QOxZq5oW26H5VtdqVF+B2OpD7to1tBWOu7adzK8frA4\r\ndebug3: hostkeys_foreach: reading file "/root/.ssh/known_hosts"\r\ndebug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:8\r\ndebug3: load_hostkeys: loaded 1 keys from vc.mysite.com\r\ndebug3: hostkeys_foreach: reading file "/root/.ssh/known_hosts"\r\ndebug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:8\r\ndebug3: load_hostkeys: loaded 1 keys from 10.200.200.10\r\ndebug1: Host \'vc.mysite.com\' is known and matches the ECDSA host key.\r\ndebug1: Found key in /root/.ssh/known_hosts:8\r\ndebug3: send packet: type 21\r\ndebug2: set_newkeys: mode 1\r\ndebug1: rekey out after 4294967296 blocks\r\ndebug1: SSH2_MSG_NEWKEYS sent\r\ndebug1: expecting SSH2_MSG_NEWKEYS\r\ndebug3: receive packet: type 21\r\ndebug1: SSH2_MSG_NEWKEYS received\r\ndebug2: set_newkeys: mode 0\r\ndebug1: rekey in after 4294967296 blocks\r\ndebug1: Will attempt key: /root/.ssh/id_rsa \r\ndebug1: Will attempt key: /root/.ssh/id_dsa \r\ndebug1: Will attempt key: /root/.ssh/id_ecdsa \r\ndebug1: Will attempt key: /root/.ssh/id_ed25519 \r\ndebug1: Will attempt key: /root/.ssh/id_xmss \r\ndebug2: pubkey_prepare: done\r\ndebug3: send packet: type 5\r\ndebug3: receive packet: type 7\r\ndebug1: SSH2_MSG_EXT_INFO received\r\ndebug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>\r\ndebug3: receive packet: type 6\r\ndebug2: service_accept: ssh-userauth\r\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\r\ndebug3: send packet: type 50\r\ndebug3: receive packet: type 53\r\ndebug3: input_userauth_banner\r\n\nVMware vCenter Server Appliance 6.7.0.46000\n\nType: vCenter Server with an embedded Platform Services Controller\n\ndebug3: receive packet: type 51\r\ndebug1: Authentications that can continue: publickey,password,keyboard-interactive\r\ndebug3: start over, passed a different list publickey,password,keyboard-interactive\r\ndebug3: preferred gssapi-with-mic,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_lookup publickey\r\ndebug3: remaining preferred: ,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_is_enabled publickey\r\ndebug1: Next authentication method: publickey\r\ndebug1: Trying private key: /root/.ssh/id_rsa\r\ndebug3: no such identity: /root/.ssh/id_rsa: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_dsa\r\ndebug3: no such identity: /root/.ssh/id_dsa: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_ecdsa\r\ndebug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_ed25519\r\ndebug3: no such identity: /root/.ssh/id_ed25519: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_xmss\r\ndebug3: no such identity: /root/.ssh/id_xmss: No such file or directory\r\ndebug2: we did not send a packet, disable method\r\ndebug1: No more authentication methods to try.\r\[email protected]: Permission denied (publickey,password,keyboard-interactive).\r\n')
fatal: [vc.mysite.com]: UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: OpenSSH_8.0p1, OpenSSL 1.1.1c FIPS  28 May 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 51: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf\r\ndebug2: checking match for 'final all' host vc.mysite.com originally vc.mysite.com\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: not matched 'final'\r\ndebug2: match not found\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-gex-sha1-,gss-group14-sha1-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1]\r\ndebug1: configuration requests final Match pass\r\ndebug1: re-parsing configuration\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug3: /etc/ssh/ssh_config line 51: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0\r\ndebug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf\r\ndebug2: checking match for 'final all' host vc.mysite.com originally vc.mysite.com\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 3: matched 'final'\r\ndebug2: match found\r\ndebug3: /etc/ssh/ssh_config.d/05-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1\r\ndebug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config\r\ndebug3: gss kex names ok: [gss-gex-sha1-,gss-group14-sha1-]\r\ndebug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1]\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket \"/tmp/awx_14178_c2borjb4/cp/255e12357a\" does not exist\r\ndebug2: resolving \"vc.mysite.com\" port 22\r\ndebug2: ssh_connect_direct\r\ndebug1: Connecting to vc.mysite.com [10.200.200.10] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: fd 3 clearing O_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 9950 ms remain after connect\r\ndebug1: identity file /root/.ssh/id_rsa type -1\r\ndebug1: identity file /root/.ssh/id_rsa-cert type -1\r\ndebug1: identity file /root/.ssh/id_dsa type -1\r\ndebug1: identity file /root/.ssh/id_dsa-cert type -1\r\ndebug1: identity file /root/.ssh/id_ecdsa type -1\r\ndebug1: identity file /root/.ssh/id_ecdsa-cert type -1\r\ndebug1: identity file /root/.ssh/id_ed25519 type -1\r\ndebug1: identity file /root/.ssh/id_ed25519-cert type -1\r\ndebug1: identity file /root/.ssh/id_xmss type -1\r\ndebug1: identity file /root/.ssh/id_xmss-cert type -1\r\ndebug1: Local version string SSH-2.0-OpenSSH_8.0\r\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_7.4\r\ndebug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: Authenticating to vc.mysite.com:22 as 'root'\r\ndebug3: hostkeys_foreach: reading file \"/root/.ssh/known_hosts\"\r\ndebug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:8\r\ndebug3: load_hostkeys: loaded 1 keys from vc.mysite.com\r\ndebug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\r\ndebug3: send packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT sent\r\ndebug3: receive packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT received\r\ndebug2: local client KEXINIT proposal\r\ndebug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,ext-info-c\r\ndebug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa\r\ndebug2: ciphers ctos: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc\r\ndebug2: ciphers stoc: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc\r\ndebug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512\r\ndebug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512\r\ndebug2: compression ctos: [email protected],zlib,none\r\ndebug2: compression stoc: [email protected],zlib,none\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug2: peer server KEXINIT proposal\r\ndebug2: KEX algorithms: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1\r\ndebug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519\r\ndebug2: ciphers ctos: [email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr\r\ndebug2: ciphers stoc: [email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr\r\ndebug2: MACs ctos: [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-sha1\r\ndebug2: MACs stoc: [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-sha1\r\ndebug2: compression ctos: none,[email protected]\r\ndebug2: compression stoc: none,[email protected]\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug1: kex: algorithm: ecdh-sha2-nistp256\r\ndebug1: kex: host key algorithm: ecdsa-sha2-nistp256\r\ndebug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: [email protected]\r\ndebug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: [email protected]\r\ndebug1: kex: ecdh-sha2-nistp256 need=32 dh_need=32\r\ndebug1: kex: ecdh-sha2-nistp256 need=32 dh_need=32\r\ndebug3: send packet: type 30\r\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\r\ndebug3: receive packet: type 31\r\ndebug1: Server host key: ecdsa-sha2-nistp256 SHA256:QOxZq5oW26H5VtdqVF+B2OpD7to1tBWOu7adzK8frA4\r\ndebug3: hostkeys_foreach: reading file \"/root/.ssh/known_hosts\"\r\ndebug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:8\r\ndebug3: load_hostkeys: loaded 1 keys from vc.mysite.com\r\ndebug3: hostkeys_foreach: reading file \"/root/.ssh/known_hosts\"\r\ndebug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:8\r\ndebug3: load_hostkeys: loaded 1 keys from 10.200.200.10\r\ndebug1: Host 'vc.mysite.com' is known and matches the ECDSA host key.\r\ndebug1: Found key in /root/.ssh/known_hosts:8\r\ndebug3: send packet: type 21\r\ndebug2: set_newkeys: mode 1\r\ndebug1: rekey out after 4294967296 blocks\r\ndebug1: SSH2_MSG_NEWKEYS sent\r\ndebug1: expecting SSH2_MSG_NEWKEYS\r\ndebug3: receive packet: type 21\r\ndebug1: SSH2_MSG_NEWKEYS received\r\ndebug2: set_newkeys: mode 0\r\ndebug1: rekey in after 4294967296 blocks\r\ndebug1: Will attempt key: /root/.ssh/id_rsa \r\ndebug1: Will attempt key: /root/.ssh/id_dsa \r\ndebug1: Will attempt key: /root/.ssh/id_ecdsa \r\ndebug1: Will attempt key: /root/.ssh/id_ed25519 \r\ndebug1: Will attempt key: /root/.ssh/id_xmss \r\ndebug2: pubkey_prepare: done\r\ndebug3: send packet: type 5\r\ndebug3: receive packet: type 7\r\ndebug1: SSH2_MSG_EXT_INFO received\r\ndebug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>\r\ndebug3: receive packet: type 6\r\ndebug2: service_accept: ssh-userauth\r\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\r\ndebug3: send packet: type 50\r\ndebug3: receive packet: type 53\r\ndebug3: input_userauth_banner\r\n\nVMware vCenter Server Appliance 6.7.0.46000\n\nType: vCenter Server with an embedded Platform Services Controller\n\ndebug3: receive packet: type 51\r\ndebug1: Authentications that can continue: publickey,password,keyboard-interactive\r\ndebug3: start over, passed a different list publickey,password,keyboard-interactive\r\ndebug3: preferred gssapi-with-mic,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_lookup publickey\r\ndebug3: remaining preferred: ,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_is_enabled publickey\r\ndebug1: Next authentication method: publickey\r\ndebug1: Trying private key: /root/.ssh/id_rsa\r\ndebug3: no such identity: /root/.ssh/id_rsa: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_dsa\r\ndebug3: no such identity: /root/.ssh/id_dsa: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_ecdsa\r\ndebug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_ed25519\r\ndebug3: no such identity: /root/.ssh/id_ed25519: No such file or directory\r\ndebug1: Trying private key: /root/.ssh/id_xmss\r\ndebug3: no such identity: /root/.ssh/id_xmss: No such file or directory\r\ndebug2: we did not send a packet, disable method\r\ndebug1: No more authentication methods to try.\r\[email protected]: Permission denied (publickey,password,keyboard-interactive).",
    "unreachable": true
}
PLAY RECAP *********************************************************************
vc.mysite.com            : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0   

Add support for VMDK growth

SUMMARY

Looking for all references to https://{api_host}/api/vcenter/vm/{vm}/hardware/disk/{disk} and the only operations I can see supported are "delete". It appears that in order to update an existing vmdk with a new size it requires a "Patch" operations as seen here

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vmware_rest.vcenter_vm_hardware_disk

ADDITIONAL INFORMATION

Looking to add support for expanding vmdk's to support increased capacity from what was originally defined at VM creation time.

Add function test coverage for all the modules

  • vcenter_cluster_info
  • vcenter_datacenter_info
  • vcenter_datacenter
  • vcenter_datastore_info
  • vcenter_folder_info
  • vcenter_host_info
  • vcenter_host
  • vcenter_network_info
  • vcenter_vm_guest_identity_info
  • vcenter_vm_guest_localfilesystem_info
  • vcenter_vm_guest_networking_info
  • vcenter_vm_guest_networking_interfaces_info
  • vcenter_vm_guest_networking_routes_info
  • vcenter_vm_guest_power_info
  • vcenter_vm_guest_power
  • vcenter_vm_hardware_action_upgrade
  • vcenter_vm_hardware_adapter_sata_info
  • vcenter_vm_hardware_adapter_sata
  • vcenter_vm_hardware_adapter_scsi_info
  • vcenter_vm_hardware_adapter_scsi
  • vcenter_vm_hardware_boot_device_info
  • vcenter_vm_hardware_boot_device
  • vcenter_vm_hardware_boot_info
  • vcenter_vm_hardware_boot
  • vcenter_vm_hardware_cdrom_info
  • vcenter_vm_hardware_cdrom
  • vcenter_vm_hardware_cpu_info
  • vcenter_vm_hardware_cpu
  • vcenter_vm_hardware_disk_info
  • vcenter_vm_hardware_disk
  • vcenter_vm_hardware_ethernet_info
  • vcenter_vm_hardware_ethernet
  • vcenter_vm_hardware_flo_info.py
  • vcenter_vm_hardware_flo.py
  • vcenter_vm_hardware_info
  • vcenter_vm_hardware_memory_info
  • vcenter_vm_hardware_memory
  • vcenter_vm_hardware_parallel_info
  • vcenter_vm_hardware_parallel
  • vcenter_vm_hardware
  • vcenter_vm_hardware_serial_info
  • vcenter_vm_hardware_serial
  • vcenter_vm_info
  • vcenter_vm_libraryitem_info
  • vcenter_vm_power_info
  • vcenter_vm_power
  • vcenter_vm
  • vcenter_vm_storage_policy_compliance_info
  • vcenter_vm_storage_policy_compliance
  • vcenter_vm_storage_policy_info
  • vcenter_vm_storage_policy
  • vcenter_vm_tools_info
  • vcenter_vm_tools

Unable to import vmware.vmware_rest.vcenter_vm_info due to invalid syntax

I initially mentioned this issue on IRC and was asked to formally file it here.

SUMMARY

Attempting to gather basic vm_info to begin testing the Vmware rest modules.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware.vmware_rest.vcenter_vm_info

ANSIBLE VERSION

ansible 2.9.13
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/mwebb/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.17 (default, Jul 20 2020, 15:37:01) [GCC 7.5.0]

CONFIGURATION
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = root
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Ubuntu 18.04.5 LTS via WSL on Windows server 2019

STEPS TO REPRODUCE

Ran "ansible-galaxy collection install vmware.vmware_rest"
Wrote test playbook below
Executed playbook with ansible-playbook -i hosts get_vmtest.yml
Received the error: Unable to import vmware.vmware_rest.vcenter_vm_info due to invalid syntax
Also installed python3-aiohttp at the advise of Goneri

        ---
        - hosts: all
          gather_facts: false
          connection: local
          vars:
            ansible_python_interpreter: /usr/bin/python3
          vars_files:
            - vcenter_vars.yml
          vars_prompt:
            - name: vcenter_password
              prompt: "Please enter vcenter password"
              private: yes    
          tasks:
             - name: Get VM Info
               vmware.vmware_rest.vcenter_vm_info:
                 vcenter_username: "{{ vcenter_username }}"
                 vcenter_password: "{{ vcenter_password }}"
                 vcenter_hostname: "{{ vcenter_hostname }}"
                 vcenter_validate_certs: no
               register: vm_info
               delegate_to: localhost
EXPECTED RESULTS

I was expecting to get some vm_info :)

ACTUAL RESULTS
ansible-playbook -i hosts get-vmtest.yml -vvvv
ansible-playbook 2.9.13
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/mwebb/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Jul 20 2020, 15:37:01) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/mwebb/Git/Ansible/vmware/hosts as it did not pass its verify_file() method
script declined parsing /home/mwebb/Git/Ansible/vmware/hosts as it did not pass its verify_file() method
auto declined parsing /home/mwebb/Git/Ansible/vmware/hosts as it did not pass its verify_file() method
Set default localhost to localhost
Parsed /home/mwebb/Git/Ansible/vmware/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc

PLAYBOOK: get-vmtest.yml ***********************************************************************************************
Positional arguments: get-vmtest.yml
remote_user: root
become_method: sudo
inventory: (u'/home/mwebb/Git/Ansible/vmware/hosts',)
forks: 5
tags: (u'all',)
verbosity: 4
connection: smart
timeout: 10
1 plays in get-vmtest.yml
Read vars_file 'vcenter_vars.yml'
Please enter vcenter password:
Read vars_file 'vcenter_vars.yml'
Read vars_file 'vcenter_vars.yml'

PLAY [all] *************************************************************************************************************
META: ran handlers
Read vars_file 'vcenter_vars.yml'
Read vars_file 'vcenter_vars.yml'

TASK [Get VM Info] *****************************************************************************************************
task path: /home/mwebb/Git/Ansible/vmware/get-vmtest.yml:21
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: mwebb
<localhost> EXEC /bin/sh -c 'echo ~mwebb && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/mwebb/.ansible/tmp `"&& mkdir "` echo /home/mwebb/.ansible/tmp/ansible-tmp-1602698642.59-1739-29260445887749 `" && echo ansible-tmp-1602698642.59-1739-29260445887749="` echo /home/mwebb/.ansible/tmp/ansible-tmp-1602698642.59-1739-29260445887749 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/mwebb/.ansible/tmp/ansible-tmp-1602698642.59-1739-29260445887749/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "msg": "Unable to import vmware.vmware_rest.vcenter_vm_info due to invalid syntax"
}

PLAY RECAP *************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Unable to create CentOS vm using vcenter_vm

SUMMARY

I am unable to create CentOS 7 VM using vcenter_vm with following yaml

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vcenter_vm

ANSIBLE VERSION
2.11 devel
CONFIGURATION

OS / ENVIRONMENT

macOS

STEPS TO REPRODUCE
---
- hosts: localhost
  gather_facts: false
  vars_files:
    - vcenter_vars.yml
  vars:
    cluster_name: 'Asia-Cluster1'
    datastore_name: 'ds_200'
    folder_name: 'prod'
    vm_name: CentOS7_Rest
  tasks:
    - name: Get Cluster info
      vmware.vmware_rest.vcenter_cluster_info:
        vcenter_username: "{{ vcenter_username }}"
        vcenter_password: "{{ vcenter_password }}"
        vcenter_hostname: "{{ vcenter_hostname }}"
        filter_names:
        - "{{ cluster_name }}"
        vcenter_validate_certs: False
      register: cluster_info

    - name: Get Resource info for {{ cluster_name }}
      vmware.vmware_rest.vcenter_cluster_info:
        vcenter_username: "{{ vcenter_username }}"
        vcenter_password: "{{ vcenter_password }}"
        vcenter_hostname: "{{ vcenter_hostname }}"
        vcenter_validate_certs: False
        cluster: "{{ cluster_info.value[0].cluster }}"
      register: resource_pool_info

    - name: Get datastore info
      vmware.vmware_rest.vcenter_datastore_info:
        vcenter_username: "{{ vcenter_username }}"
        vcenter_password: "{{ vcenter_password }}"
        vcenter_hostname: "{{ vcenter_hostname }}"
        vcenter_validate_certs: False
        filter_names:
        - "{{ datastore_name }}"
      register: datastore_info

    - name: Get folder info
      vmware.vmware_rest.vcenter_folder_info:
        vcenter_username: "{{ vcenter_username }}"
        vcenter_password: "{{ vcenter_password }}"
        vcenter_hostname: "{{ vcenter_hostname }}"
        vcenter_validate_certs: False
        filter_names:
        - '{{ folder_name }}'
      register: folder_info

    - debug:
        msg: "{{ cluster_info.value[0].cluster }} {{ datastore_info.value[0].datastore }} {{ folder_info.value[0].folder }} {{ resource_pool_info.value.resource_pool }}"

    - name: Create a VM
      vmware.vmware_rest.vcenter_vm:
        vcenter_username: "{{ vcenter_username }}"
        vcenter_password: "{{ vcenter_password }}"
        vcenter_hostname: "{{ vcenter_hostname }}"
        vcenter_validate_certs: False
        placement:
          cluster: '{{ cluster_info.value[0].cluster }}'
          datastore: '{{ datastore_info.value[0].datastore }}'
          folder: '{{ folder_info.value[0].folder }}'
          resource_pool: '{{ resource_pool_info.value.resource_pool }}'
        name: "{{ vm_name }}"
        guest_OS: CENTOS_7_64
        hardware_version: VMX_12
        state: present
        boot:
          type: BIOS
        memory:
          hot_add_enabled: true
          size_MiB: 2048
        # disks:
        #   - new_vmdk:
        #       capacity: 50000000000
        cdroms:
          - backing:
              # device_access_type: EMULATION
              iso_file: "[ds_171_2] isos/CentOS-7.0-1406-x86_64-DVD.iso"
              type: ISO_FILE
          - backing:
              # device_access_type: EMULATION
              iso_file: "[ds_200] iso/kickstart_config.iso"
              type: ISO_FILE

EXPECTED RESULTS

VM should be created

ACTUAL RESULTS
TASK [Create a VM] ****************************************************************************
task path: /Volumes/data/src/playbooks/vmware/REST/create_vm.yml:54
fatal: [localhost]: FAILED! => {"_debug_info": {"operation": "create", "status": 400}, "changed": false, "type": "com.vmware.vapi.std.errors.unsupported", "value": {"messages": [{"args": ["CENTOS_7_64"], "default_message": "Unable to get recommended disk size for the guest OS. Guest OS 'CENTOS_7_64' is not supported.", "id": "com.vmware.api.vcenter.vm.device.disk.unsupported_gos_get_disk_size"}]}}

gen_args does not concatenate correctly

SUMMARY

gen_args does not concatenate as expected.

The current behavior: In the case if isinstance(v, list):, the actual results is
https://vcenter.test/api/vcenter/folder?datacenters=datacenter-1001&names=bar_foldernames=foo_foldernames=vm
I would expect to have something similar:
https://vcenter.test/api/vcenter/folder?datacenters=datacenter-1001&names=bar_folder&names=foo_folder&names=vm

ISSUE TYPE
  • Bug Report
COMPONENT NAME

module_utils/vmware_rest.py

appliance_ntp check_mode not respected

SUMMARY

When using the appliance_ntp module with either 'check_mode: yes' in the task or --check at the command line, this is not respected and the module make real changes to the environment. No errors or warnings displayed

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware.vmware_rest.appliance_ntp

ANSIBLE VERSION
ansible 2.10.11
  config file = /home/username/Ansible/ansible.cfg
  configured module search path = ['/home/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Mar 18 2021, 08:58:41) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
COLLECTION VERSION
2.1.0
CONFIGURATION

OS / ENVIRONMENT

Red Hat Enterprise Linux 8.4

STEPS TO REPRODUCE

Add a task to manage NTP settings. From the command line, add the --check flag. Observe that some entries are marked as Changed, but with check mode, it should not actually perform the change. Run the same playbook immediately after with no modifications, and it returns OK because the settings were actually changed on the host

    - name: Adjust the NTP configuration
      vmware.vmware_rest.appliance_ntp:
        vcenter_hostname: "{{ inventory_hostname }}"
        vcenter_username: "{{ vcenter_user }}"
        vcenter_password: "{{ vcenter_password }}"
        vcenter_validate_certs: "{{ vmware_validate_certs }}"
        servers: "{{ ntp_servers }}"
      delegate_to: localhost
      tags:
        - ntp
EXPECTED RESULTS

With the --check flag, it should show Changed for items that would be changed, but these should not actually be modified on the host

ACTUAL RESULTS

Changes are made to the host, even with --check defined


vmware.vmware_rest collection fails on ansible tower

SUMMARY

When using the wmware.vmware_rest collection on ansible tower it fails while complaining about missing python modules.

In my test case it complains about not being able to find aoihttp.
I have checked Ansible Tower, and the ansible tower installation does contain this python module.

For some reason the collection can't seem to find that python module.

This all works fine when using ansible on the command line from a centos8 controller

ISSUE TYPE
  • Bug Report
COMPONENT NAME

the vmware.vmware_rest collection used on ansible tower

ANSIBLE VERSION
ansible 2.9.15
ansible tower 3.7.3

CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE

create a git project containing the play and an inventory
in tower:
configure a secret if you are using vaults in your project
set up a project in tower using the git as a source
set up an inventory using the project as a source (the project must contain an inventory )
set up a template using the previous items
launch a job from the template.

  hosts: localhost
  become: false
  gather_facts: false
  vars:
    vcenter_host: vsphere_host
    vcenter_username: admin
    vcenter_password: secret
  collections:
  - vmware.vmware_rest

  tasks:
  - name: get vm moid
    vmware.vmware_rest.vcenter_vm_info:
      vcenter_hostname: "{{ vcenter_host }}"
      vcenter_password: "{{ vcenter_password }}"
      vcenter_username: "{{ vcenter_username }}"
      vcenter_validate_certs: false
      filter_names: centos8
    register: vm_find_res
    until: not vm_find_res['failed']
    retries: 720
    delay: 5
EXPECTED RESULTS

the play to finish

ACTUAL RESULTS
{
    "msg": [
        "  File \"/usr/lib64/python3.6/runpy.py\", line 193, in _run_module_as_main\n    \"__main__\", mod_spec)\n",
        "  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n",
        "  File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_iuig08u9/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 231, in <module>\n",
        "  File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_iuig08u9/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 210, in start\n",
        "  File \"/usr/lib64/python3.6/asyncio/base_events.py\", line 438, in run_forever\n    self._run_once()\n",
        "  File \"/usr/lib64/python3.6/asyncio/base_events.py\", line 1451, in _run_once\n    handle._run()\n",
        "  File \"/usr/lib64/python3.6/asyncio/events.py\", line 145, in _run\n    self._callback(*self._args)\n",
        "  File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_iuig08u9/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 192, in handle\n",
        "Traceback (most recent call last):\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_iuig08u9/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py\", line 150, in run\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_iuig08u9/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/modules/vcenter_vm_info.py\", line 378, in main\n    log_file=module.params[\"vcenter_rest_log_file\"],\n  File \"/tmp/ansible_vmware.vmware_rest.vcenter_vm_info_payload_iuig08u9/ansible_vmware.vmware_rest.vcenter_vm_info_payload.zip/ansible_collections/vmware/vmware_rest/plugins/module_utils/vmware_rest.py\", line 24, in open_session\n    aiohttp = importlib.import_module(\"aiohttp\")\n  File \"/usr/lib64/python3.6/importlib/__init__.py\", line 126, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n  File \"<frozen importlib._bootstrap>\", line 994, in _gcd_import\n  File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\n  File \"<frozen importlib._bootstrap>\", line 953, in _find_and_load_unlocked\nModuleNotFoundError: No module named 'aiohttp'\n"
    ],
    "invocation": {
        "module_args": {
            "vcenter_hostname": "vsphere_host",
            "vcenter_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "vcenter_username": "admin",
            "vcenter_validate_certs": false,
            "filter_names": [
                "centos8"
            ],
            "vcenter_rest_log_file": null,
            "filter_clusters": null,
            "filter_datacenters": null,
            "filter_folders": null,
            "filter_hosts": null,
            "filter_power_states": null,
            "filter_resource_pools": null,
            "filter_vms": null,
            "vm": null
        }
    },
    "_ansible_no_log": false,
    "attempts": 1,
    "changed": false,
    "retries": 721
}

"VMware Tools are not running in Virtual machine" error when target VM is not running

Does a VM have to be running for the vvmware_rest API modules to be able to access it?

I get the below error when I invoke the vcenter_vm_guest_identity_info module and the target VM is not running:

14:12:48  TASK [Get VM identity information about the Debian 10 base image] **************
14:12:48  fatal: [localhost]: FAILED! => changed=false 
14:12:48    _debug_info:
14:12:48      operation: get
14:12:48      status: 503
14:12:48    type: com.vmware.vapi.std.errors.service_unavailable
14:12:48    value:
14:12:48      messages:
14:12:48      - args:
14:12:48        - vm-538:b3abe66d-7f98-48f5-96af-d96bb146aa35
14:12:48        default_message: VMware Tools are not running in Virtual machine with identifier 'vm-538:b3abe66d-7f98-48f5-96af-d96bb146aa35'.
14:12:48        id: com.vmware.api.vcenter.vm.guest.tools_not_running

This error goes away after I have started up the VM manually and rerun the same playbook (see below).

Is this expected? Does the vcenter_vm_guest_identity_info module require the vm to be running?

The controller and the target VM are Debian 10, and the guest has the open-vm-tools package from Debian Buster installed, Version 2:10.3.10, and the open-vm-tools-dev package, Version 2:10.3.10. These tools appear to be working fine from the vSphere web client which recognizes the tools are installed. I understand that this just means the VMTools are "Guest Managed" in vSphere speak, but as far as I know, functionally everything should work. "Guest managed" just means that I can't use vCenter to install or update vm tools.

In this case, the target VM is in a Folder, FWIW.

Another problem I'm having irrespective of whether vm is running or not. I am simply following the instructions here and in the module docs, where you indicate that the vcenter_vm_info module is supposed to return an id in the return value. I am NOT getting an id back from the vcenter_vm_info module. Instead I see an element named vm that looks like a string that might be the id. Is this a typo in the documentation? Is the vm element the id that needs to get passed to other modules to affect a specific VM? i.e. is vm the moid?

E.g. in my below playbook:

- name: Discover and Print Information about vCenter Resources
  hosts: localhost
  connection: local
  environment:
    VMWARE_USER: me
    VMWARE_PASSWORD: mypasswd
    VMWARE_REST_LOG_FILE: "{{ lookup('env', 'VMWARE_REST_LOG_FILE') }}"
    VMWARE_HOST: myvcenter
    VMWARE_VALIDATE_CERTS: no
  tasks:
    - name: Print out Environment
      debug:
        msg: |
          Environment Variables ("environment"):
          {{ environment | to_nice_json }}
    - name: Inspect vCenter Resources and Print out Details
      include: inspect-vcenter.yml
    - name: |
        Get VM Information about the Debian10 Base Image.
        Bc the vmware.vmware_rest collection does not yet support templates directly:
          https://github.com/ansible-collections/vmware.vmware_rest/issues/149#issuecomment-800582219
        we modified the debian10 packer project to just produce a regular VM instead of a template.
      vmware.vmware_rest.vcenter_vm_info:
        filter_names:
          - debian10
      register: debian10_vcenter_vm_info
    - name: Inspect Registered Variables
      debug:
        var: "{{ item }}"
      with_items:
        - debian10_vcenter_vm_info
        - debian10_vcenter_vm_info.value
        - debian10_vcenter_vm_info.value[0].vm
    - debug:
        msg: "value length = {{ debian10_vcenter_vm_info.value | length }}"
    - name: Assert only one machine with this name exists
      fail:
        msg: More than one VM with the specified name exists! That's bad!
      when: debian10_vcenter_vm_info.value | length != 1
    - name: Get VM identity information about the Debian 10 base image
      vmware.vmware_rest.vcenter_vm_guest_identity_info:
        vm: '{{ debian10_vcenter_vm_info.value[0].vm }}'
      register: debian10_identity_info
    - debug: var=debian10_identity_info

produces the following output excerpt:

14:23:40  TASK [Get VM Information about the Debian10 Base Image.
14:23:40  Bc the vmware.vmware_rest collection does not yet support templates directly:
14:23:40    https://github.com/****-collections/vmware.vmware_rest/issues/149#issuecomment-800582219
14:23:40  we modified the debian10 packer project to just produce a regular VM instead of a template.] ***
14:23:40  ok: [localhost]
14:23:40  
14:23:40  TASK [Inspect Registered Variables] ********************************************
14:23:40  ok: [localhost] => (item=debian10_vcenter_vm_info) => 
14:23:40    ****_loop_var: item
14:23:40    debian10_vcenter_vm_info:
14:23:40      _debug_info:
14:23:40        operation: get
14:23:40        status: 200
14:23:40      changed: false
14:23:40      failed: false
14:23:40      value:
14:23:40      - cpu_count: 8
14:23:40        memory_size_MiB: 1024
14:23:40        name: debian10
14:23:40        power_state: POWERED_ON
14:23:40        vm: vm-538
14:23:40    item: debian10_vcenter_vm_info
14:23:40  ok: [localhost] => (item=debian10_vcenter_vm_info.value) => 
14:23:40    ****_loop_var: item
14:23:40    debian10_vcenter_vm_info.value:
14:23:40    - cpu_count: 8
14:23:40      memory_size_MiB: 1024
14:23:40      name: debian10
14:23:40      power_state: POWERED_ON
14:23:40      vm: vm-538
14:23:40    item: debian10_vcenter_vm_info.value
14:23:40  ok: [localhost] => (item=debian10_vcenter_vm_info.value[0].vm) => 
14:23:40    ****_loop_var: item
14:23:40    debian10_vcenter_vm_info.value[0].vm: vm-538
14:23:40    item: debian10_vcenter_vm_info.value[0].vm
14:23:40  
14:23:40  TASK [debug] *******************************************************************
14:23:40  ok: [localhost] => 
14:23:40    msg: value length = 1
14:23:40  
14:23:40  TASK [Assert only one machine with this name exists] ***************************
14:23:40  skipping: [localhost]
14:23:40  
14:23:40  TASK [Get VM identity information about the Debian 10 base image] **************
14:23:41  ok: [localhost]
14:23:41  
14:23:41  TASK [debug] *******************************************************************
14:23:41  ok: [localhost] => 
14:23:41    debian10_identity_info:
14:23:41      _debug_info:
14:23:41        operation: get
14:23:41        status: 200
14:23:41      changed: false
14:23:41      failed: false
14:23:41      value:
14:23:41        family: LINUX
14:23:41        full_name:
14:23:41          args: []
14:23:41          default_message: Debian GNU/Linux 10 (64-bit)
14:23:41          id: vmsg.guestos.debian10_64Guest.label
14:23:41        host_name: debian10
14:23:41        ip_address: 172.16.22.29
14:23:41        name: DEBIAN_10_64

Ansible playbook is running in jenkins. Below is a dump of environment, including python and ansible version/config.

14:23:33  ###############################################
14:23:33      BEGIN INTROSPECTION
14:23:33  PYTHON_INTERPRETER_PATH = /home/jenkins/.pyenv/versions/Ansible-vsphere-e-feature-SWOPS-832/bin/python
14:23:33  + pyenv version
14:23:33  + local command
14:23:33  + command=version
14:23:33  + '[' 1 -gt 0 ']'
14:23:33  + shift
14:23:33  + case "$command" in
14:23:33  + command pyenv version
14:23:33  + pyenv version
14:23:33  Ansible-vsphere-e-feature-SWOPS-832 (set by PYENV_VERSION environment variable)
14:23:33  + pip list
14:23:33  Package                            Version
14:23:33  ---------------------------------- ------------------
14:23:33  aiohttp                            3.7.4.post0
14:23:33  ****                            2.10.0
14:23:33  ****-base                       2.10.6
14:23:33  async-timeout                      3.0.1
14:23:33  attrs                              20.3.0
14:23:33  certifi                            2020.12.5
14:23:33  cffi                               1.14.5
14:23:33  chardet                            4.0.0
14:23:33  cryptography                       3.4.6
14:23:33  idna                               2.10
14:23:33  Jinja2                             2.11.3
14:23:33  lxml                               4.6.2
14:23:33  MarkupSafe                         1.1.1
14:23:33  multidict                          5.1.0
14:23:33  nsx-policy-python-sdk              3.0.2.0.0.16837625
14:23:33  nsx-python-sdk                     3.0.2.0.0.16837625
14:23:33  nsx-vmc-aws-integration-python-sdk 3.0.2.0.0.16837625
14:23:33  nsx-vmc-policy-python-sdk          3.0.2.0.0.16837625
14:23:33  packaging                          20.9
14:23:33  pip                                21.0.1
14:23:33  pycparser                          2.20
14:23:33  pyOpenSSL                          20.0.1
14:23:33  pyparsing                          2.4.7
14:23:33  pyvmomi                            7.0.1
14:23:33  PyYAML                             5.4.1
14:23:33  requests                           2.25.1
14:23:33  setuptools                         49.2.1
14:23:33  six                                1.15.0
14:23:33  suds-jurko                         0.6
14:23:33  typing-extensions                  3.7.4.3
14:23:33  urllib3                            1.26.3
14:23:33  vapi-client-bindings               3.5.0
14:23:33  vapi-common-client                 2.19.0
14:23:33  vapi-runtime                       2.19.0
14:23:33  vmc-client-bindings                1.34.0
14:23:33  vmc-draas-client-bindings          1.17.0
14:23:33  vSphere-Automation-SDK             1.48.0
14:23:33  yarl                               1.6.3
14:23:33  + **** --version
14:23:34  **** 2.10.6
14:23:34    config file = /home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg
14:23:34    configured module search path = ['/home/jenkins/.****/plugins/modules', '/usr/share/****/plugins/modules']
14:23:34    **** python module location = /home/jenkins/.pyenv/versions/3.9.0/envs/Ansible-vsphere-e-feature-SWOPS-832/lib/python3.9/site-packages/****
14:23:34    executable location = /home/jenkins/.pyenv/versions/Ansible-vsphere-e-feature-SWOPS-832/bin/****
14:23:34    python version = 3.9.0 (default, Mar  9 2021, 12:09:04) [GCC 8.3.0]
14:23:34  + ****-config dump --only-changed
14:23:34  ANSIBLE_PIPELINING(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = True
14:23:34  ANSIBLE_SSH_ARGS(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
14:23:34  COLLECTIONS_PATHS(env: ANSIBLE_COLLECTIONS_PATH) = ['/home/jenkins/.****/collections/Ansible-vsphere-e-feature-SWOPS-832']
14:23:34  DEFAULT_CALLBACK_WHITELIST(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = ['timer']
14:23:34  DEFAULT_FORKS(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = 20
14:23:34  DEFAULT_KEEP_REMOTE_FILES(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = True
14:23:34  DEFAULT_LOAD_CALLBACK_PLUGINS(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = True
14:23:34  DEFAULT_LOG_PATH(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = /home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.log
14:23:34  DEFAULT_MANAGED_STR(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = #Ansible managed by user {uid} on {host} from template file:
14:23:34  
14:23:34  DEFAULT_POLL_INTERVAL(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = 5
14:23:34  DEFAULT_REMOTE_USER(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = ****
14:23:34  DEFAULT_ROLES_PATH(env: ANSIBLE_ROLES_PATH) = ['/home/jenkins/.****/roles/Ansible-vsphere-e-feature-SWOPS-832']
14:23:34  DEFAULT_STDOUT_CALLBACK(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = yaml
14:23:34  HOST_KEY_CHECKING(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = False
14:23:34  INTERPRETER_PYTHON(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = auto
14:23:34  RETRY_FILES_ENABLED(/home/jenkins/.jenkins/workspace/eering-services-vsphere-template/****/projects/vsphere-engineering-services-template/****.cfg) = False
14:23:34      END INTROSPECTION
14:23:34  ###############################################

vcenter_vm_storage_policy module throws <class 'dict'> cannot be converted to a list

SUMMARY

vcenter_vm_storage_policy throws

TASK [vcenter_vm_scenario1 : Adjust VM storage policy] **************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "argument disks is of type <class 'dict'> and we were unable to convert to list: <class 'dict'> cannot be converted to a list"}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

vcenter_vm_storage_policy

STEPS TO REPRODUCE
- name: Prepare the disk policy dict
  set_fact:
    vm_disk_policy: "{{ {} | combine({ my_new_disk.id: {'policy': my_storage_policy.policy, 'type': 'USE_SPECIFIED_POLICY'} }) }}"

- name: Adjust VM storage policy
  vmware.vmware_rest.vcenter_vm_storage_policy:
    vm: '{{ test_vm1_info.id }}'
    vm_home:
      type: USE_DEFAULT_POLICY
    disks: '{{ vm_disk_policy }}'
  register: _result

Add modules/support for vRealize LogInsight

SUMMARY

Create modules to deploy and configure vRealize LogInsight using Ansible.

Configure settings such as:
image

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vRealize LogInsight modules, probably scraped from the vRLI API.

ADDITIONAL INFORMATION

Automated deployment/configuration of vRealize Operations Manager and it's integration with vSphere.
Contributes towards completion of Ansible modules available for the VMware vRealize suite.

None exist yet for vRealize LogInsight. It is typically configured via the UI (but has API support).

documentation of vm_module really needs work

SUMMARY

Hello,

Today I've managed to create a vm using the vm_module, this was not an easy task.
I've been busy trying to figure out what the correct syntax was by using the doc, example, vmware api documentation and reading the python code.
After quite some time I managed to launch a heavily customized vm.

The issues I've faced during this proces:

  • in the documentation parameters , cdroms, disks, and nics really could use another column for readability.
    • it is really hard to read and see what options are for which dict,another column would solve this.
    • ie: cdroms is a list containing nested dicts, try to see what the legal values are for which key is next to impossible
    • same goes for floppies I gues, but I don't use those anymore
    • it is very hard to see which option will be defaulted by the vcenter if omitted and to what value.
    • it is very hard to see what option is required when another option is set (ie: nics backend=>network requires backend=>type)
  • MOID is used everywhere, this should mentioned that you need to find the moid for the network/datastore/cluster/vm/folder
    • the option to use a name in stead of a moid would have been nice, converting a name to moid is easy for one nic, however creating a definition with multiple networks will be a challenge if you know only the network names.
    • name to moid conversion takes a lot of boilerplate code in ansible, please implement something to make the conversion easy vmware kb
  • only a very simple default create vm example is included, please include one that has custom nics/disks/cdroms it would have saved me a lot of time
  • an example showing custom adapters ide/sata/scsi will help as well (for me the default were fine)
  • an example for the boot and boot_devices
  • maybe also for serial and parallel ports (although this is rather exotic, I can't remember any situation where I could have used this)
ISSUE TYPE
  • Documentation Report
COMPONENT NAME
ANSIBLE VERSION

please add modules to work with libraries

SUMMARY

Please add modules to work with libraries.

There are no modules to work with libraries

  • create a library item (template) from a vm
  • create a vm from a library item (template)
  • upload an item to a library
  • download an item from a library
  • rename items in libraries
ISSUE TYPE
  • Feature Idea
COMPONENT NAME
ADDITIONAL INFORMATION

Links in Read Me on Ansible Galaxy are not valid

SUMMARY

The links in README.md don't work because they refer to vmware_rest.git instead of vmware_rest. This also affects the "Read Me" on galaxy.

The vmware collection had the same issue, ansible-collections/community.vmware#389.

After renaming this repo, I think you should change vmware_rest.git to vmware.vmware_rest while you're at it. The vmware collection was renamed after fixing this so I had to issue PR ansible-collections/community.vmware#396, but you can fix this in one go.

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

README.md

Check for missing commits vs devel vs migration process

SUMMARY

The "Big Migration" has now taken place.

As this collection already exists, we need to carefully check to see if any further commits went into devel since this repo was created. Also to see if there are any parts of the migration.py rewrite to existing code that need applying to this repo

Please check the contents of https://github.com/ansible-collection-migration/community.vmware_rest against this repo

In particular:

  • Please do a per-file level diff against every file in the ansible-collection-migration repo and this one
  • Pay care to files added and removed.
  • During the last two weeks there have been lots of fixes, especially around and tests, dependencies, and new collection features e.g. meta/action_groups.yml
ISSUE TYPE
  • Bug Report

Add module for vSphere certificate management

SUMMARY

Add module for vSphere certificate management using the Set-VIMachineCertificate API.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
ADDITIONAL INFORMATION

In PowerCLI 12.4, I heard it had a new Invoke- cmdlet to call the REST API like Invoke-RenewTls.

https://blogs.vmware.com/PowerCLI/2021/09/powercli-12-4-whats-new.html

For example,

> Connect-VIServer vcsa.api.lab

Specify Credential
Please specify server credential
User: [email protected]
Password for user [email protected]: ********


Name                           Port  User
----                           ----  ----
vcsa.api.lab                   443   VSPHERE.LOCAL\Administrator

> Invoke-RenewTls

use fqcn in documentation

SUMMARY

Hello, with the release of ansible 2.10 the collections have been pushed forward as the way to go.
The release notes describe the use of fqcn

Currently the modules doc links make use of the fqcn, however the documentation does not make use of the fqcn.

Shouldn't the documentation make use of the fqcn in stead of only the short module name ?

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
ADDITIONAL INFORMATION

`ansible-galaxy collection install` fails due to missing manifest.json

SUMMARY

Downloaded the vmware.vmware_rest-1.0.1.tar.gz file from the ansible automation hub to do a local install as my environment is disconnected. When trying to install the downloaded file, I get an error as shown below.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

collection

ANSIBLE VERSION
$ ansible --version
ansible 2.10.2
  config file = None
  configured module search path = ['/home/myuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/myuser/ansible/venv/lib64/python3.6/site-packages/ansible
  executable location = /home/myuser/ansible/venv/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
CONFIGURATION

OS / ENVIRONMENT

RHEL 8 / CENTOS 8

STEPS TO REPRODUCE
$ ansible-galaxy collection install ~/vmware.vmware_rest-1.0.1.tar.gz
Starting galaxy collection install process
Process install dependency map
ERROR! Collection at '/home/myuser/vmware.vmware_rest-1.0.1.tar.gz' does not contain the required file MANIFEST.json.
EXPECTED RESULTS

Collection is installed in the current working directory

ACTUAL RESULTS
ERROR! Collection at '/home/myuser/vmware.vmware_rest-1.0.1.tar.gz' does not contain the required file MANIFEST.json.

aiohttp Python version requirement confusing

SUMMARY

On the main page:
https://github.com/ansible-collections/vmware.vmware_rest
there is conflicting information about what version of python is needed for aiohttp.

Under the heading "Python version compatibility" it says that it requires Python 3.7 or greater with a link to:
https://github.com/aio-libs/aiohttp#requirements

Under the heading of "install the dependencies" it says Python 3.6 or greater is required and has a link for aiohttp to a different site that supports this claim:
https://docs.aiohttp.org/en/stable/

Need to resolve the discrepancy. Does it need Python 3.6 or 3.7 as a minimum? What version of aiohttp is required as the links refer to either 3.7.4.post0 or 3.7.3

ISSUE TYPE
  • Documentation Report
COMPONENT NAME
ANSIBLE VERSION

TODO list for 1.0.0

Important

  • add functional test coverage for all the modules (#45)
  • review the documentation (#102)
  • pass ansible-test sanity
    • enable ansible-test-sanity-vmware-rest in Zuul ansible/ansible-zuul-jobs#627
    • deal with filter.foo (parameter-invalid) parameters #47
    • defines type as list but elements is not defined (parameter-list-no-elements)
  • rename the repository (#18)
  • release cloud.common on Galaxy
  • review the documentation of the modules
    • short description
  • Understand why we've got two different modules to handle the power managment of the guest: vcenter_vm_guest_power and vcenter_vm_power.
  • Correctly handle the case where the end-points don't expect a structure called "spec", but just a simple dict of key.
  • Properly pass environment variables to Ansible Module Turbo.

communication

  • prepare an article to introduce the new collection (0.1.0)
  • prepare another article to explain how to use the new collection (review in progress: ansible/ansible#72090)

Nice to have

  • expose more Ansible-ish state names, e.g: rename state: create to state: present
  • give away to overwrite some sections of the documentation of a module. e.g: I'm fine with the auto-generated content, but I just want to clarify one parameter.
  • give the users the ability to use a name+folder to identify a resource, like with community.vmware.

Is there a way to generate a dynamic inventory with this collection

SUMMARY
ISSUE TYPE
  • Feature Idea
COMPONENT NAME
ADDITIONAL INFORMATION

Simply put this would have a plugin in the collection that allows us to do similar actions that can be done in the community.vmware dynamic inventory plugin without having to install VMWare's custom python libraries.

The inventory file would be called and match a pattern like *vmware_rest.yml, such as:

ansible-playbook -i inv/my_vmware_rest.yml myplaybook.yml

If this is already possible then the request is for documentation in the main README

Now way to adjust the timeout easily

SUMMARY

vcenter_ovf_libraryitem is known for triggering timeout. There is no simple way to adjust the default (300s) timeout.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

COLLECTION VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

All doc links in readme.md are dead

SUMMARY

Hi when clicking a doc link in the readme.md it is dead, I have yet to find one that works.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

document the fact vcenter_resourcepool is not idempotent

Copy past of the message from @matthewcosgrove #153 (comment)

✂️✂️✂️✂️✂️✂️

Dropping my working example here. I am using the cluster details response "my_cluster_details" which contains the moid of its default resource pool which has to be used as the parent

- name: Create resource pool
  hosts: localhost
  vars:
    existing_cluster: "{{ lookup('env', 'GOVC_CLUSTER') }}"

  collections:
  - vmware.vmware_rest
  tasks:
  - name: "get parent cluster for resource pool"
    vcenter_cluster_info:
      filter_names:
      - "{{ existing_cluster }}"
    register: my_cluster
  - name: "get parent cluster details"
    vcenter_cluster_info:
      cluster: '{{ my_cluster.value[0].cluster }}'
    register: my_cluster_details
  - debug: msg="{{ my_cluster_details }}"
  - name: "ensure resource pool created"
    vcenter_resourcepool:
      name: "new-resource-pool"
      parent: "{{ my_cluster_details.value.resource_pool }}"
    register: my_resource_pool
  - debug: msg="{{ my_resource_pool }}"

Unfortunately, I am responsible for ensuring that its idempotent.

First run: works fine
Second run: fatal: [localhost]: FAILED! => {"_debug_info": {"operation": "create", "status": 400}, "changed": false, "type": "com.vmware.vapi.std.errors.invalid_argument", "value": {"error_type": "INVALID_ARGUMENT", "messages": []}}

Not an overly helpful error message there.

Would have hoped state: present results in automatic skipping logic implemented in the module. Maybe a downside of auto-generation from the API I suppose.

So finally, to ensure idempotency I have this solution:

- name: Create resource pool
  hosts: localhost
  vars:
    existing_cluster: "{{ lookup('env', 'GOVC_CLUSTER') }}"
    new_resource_pool_name: "new-resource-pool"

  collections:
  - vmware.vmware_rest
  tasks:
  - name: "get parent cluster for resource pool"
    vcenter_cluster_info:
      filter_names:
      - "{{ existing_cluster }}"
    register: my_cluster
  - name: "get parent cluster details"
    vcenter_cluster_info:
      cluster: '{{ my_cluster.value[0].cluster }}'
    register: my_cluster_details
  - debug: msg="{{ my_cluster_details }}"
  - name: "check resource pool exists"
    vcenter_resourcepool_info:
      filter_names: "{{ new_resource_pool_name  }}"
      filter_clusters: "{{ my_cluster_details.id }}"
    register: rp_already_exists
  - debug: msg="{{ rp_already_exists }}"
  - name: "ensure resource pool created"
    vcenter_resourcepool:
      name: "{{ new_resource_pool_name  }}"
      parent: "{{ my_cluster_details.value.resource_pool }}"
    register: my_resource_pool
    when: not rp_already_exists.value
  - debug: msg="{{ my_resource_pool }}"

NOTE: the importance of filtering by cluster in "check resource pool exists" because my resource pool name might not be unique within the vcenter instance.

If you have any more elegant approaches, I would like to see them.

And thanks again for pointing me in the right direction.

Add modules/support for vRealize

SUMMARY

Create modules to deploy and configure vRealize Operations Manager using Ansible.

Primarily to idempotently configure:

  • All config found under: https://vropsaddress.whatever/ui/index.action#/administration (Access Control, Authentication Sources, Cloud Accounts, Other Accounts, Management Packs, Policies, Certificates, Log Forwarding, Outbound Settings, etc. etc.)
    image
  • Configure Alerting (Alert Definitions, Symptom Definitions, etc)
    image
  • Configure Environment:
    image

Would be nice:

  • Configure Dashboards
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vRealize Operations Manager modules, probably scraped from the vROps API.

ADDITIONAL INFORMATION

Automated deployment/configuration of vRealize Operations Manager and it's integration with vCenter.
Contributes towards completion of Ansible Modules for the VMware vRealize suite.

None exist yet for vROps. It is typically configured via the UI (but has API support).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.