Error while deploying virtual machine from a template on VMware VCenter Server. Cannot complete login due to an incorrect user name or password.

ANSIBLE VERSION USED: 2.2.0

I am trying to deploy a virtual machine from a template that is already present on an ESX which is managed by a VCenter Server.

I’m getting the following error after the execution of my playbook:

“Cannot connect to x.x.x.x: [InvalidLoginFault]: Cannot complete login due to an incorrect user name or password.”

Playbook is as follows:

- vsphere_guest:
    vcenter_hostname: x.x.x.x
    username: myuser
    password: mypass
    guest: newvm01
    from_template: yes
    template_src: sometemplate
    cluster: MainCluster
    resource_pool: "temppool"
    validate_certs: False

When I ran the playbook in the verbose(-vvv) mode, the following things were observed:

----------------------------------------------------------------------------------------------------------------------------------
fatal: [127.0.0.1]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "cluster": "MainCluster",
            "esxi": {},
            "force": false,
            "from_template": true,
            "guest": "newvm01",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "power_on_after_clone": true,
            "resource_pool": "temppool",
            "snapshot_to_clone": null,
            "state": "present",
            "template_src": "sometemplate",
            "username": "myuser}",
            "validate_certs": false,
            "vcenter_hostname": "x.x.x.x",
            "vm_disk": {},
            "vm_extra_config": {},
            "vm_hardware": {},
            "vm_hw_version": null,
            "vm_nic": {},
            "vmware_guest_facts": null
        },
        "module_name": "vsphere_guest"
    },
    "msg": "Cannot connect to x.x.x.x: [InvalidLoginFault]: Cannot complete login due to an incorrect user name or password."
}

PLAY RECAP *********************************************************************
127.0.0.1                  : ok=0    changed=0    unreachable=0    failed=1

The password value is not getting reflected for the json key password.

ANSIBLE VERSION USED: 2.2.0

I am trying to deploy a virtual machine from a template that is already
present on an ESX which is managed by a VCenter Server.

I'm getting the following error after the execution of my playbook:

"Cannot connect to x.x.x.x: [InvalidLoginFault]: Cannot complete login due
to an incorrect user name or password."

-snip-

           "guest": "newvm01",
           "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
           "power_on_after_clone": true,

-snip-

The password value is not getting reflected for the json key password.

Ansible masks the password from the output to prevent those credentials are being inadvertently shared with people who should not have access to it. (like this forum)

The error to me means that the username/password combination is incorrect. Maybe you are targeting the wrong infrastructure, or the password is mangled, maybe turn it explicitely in a string in yaml ?

PS We are heavily refactoring the vmware_guest module, both in speed and functionality. Look at the recently opened/closed pull-requests in GitHub to see what is happening. We are always looking for people to provide feedback during refactoring/development.

Kind regards,