community.vmware
community.vmware copied to clipboard
Unable to make a clone of VM on Vcenter when launching module community.vmware.vmware_guest_instant_clone with error "msg": "Datacenter not found
SUMMARY
Hi Community,
I am keep getting the error message "msg": "Datacenter not found. when I launch the below playbook from my ansible tower and this module is unable to create a clone of my VM in Vcenter. As you could see I am using the community module vmware_guest_instant_clone which I had imported into my ansible tower server. The below is my example playbook for your reference. I am reachable via my email [email protected], and my git hub id is yashvanth94
- hosts: localhost
gather_facts: False
connection: local
tasks:
- name: Instant Clone a VM
community.vmware.vmware_guest_instant_clone:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
folder: "/{{ datacenter }}/vm/"
datastore: "{{ rw_datastore }}"
datacenter: "{{ datacenter }}"
host: "{{ esxi_hostname }}"
name: "{{ clone_vm }}"
parent_vm: "{{ parent_vm }}"
resource_pool: "{{ resource_pool }}"
register: vm_clone
delegate_to: localhost
ISSUE TYPE
- Bug Report
COMPONENT NAME
Module name: community.vmware.vmware_guest_instant_clone
ANSIBLE VERSION
ansible version = 2.9.27
COLLECTION VERSION
ansible-galaxy collection list = community.vmware.vmware_guest_instant_clone
CONFIGURATION
OS / ENVIRONMENT
ansible version = 2.9.27 OS Type = Red Hat Enterprise Linux release 8.2 (Ootpa) Ansible Tower version = 3.8.5.1
STEPS TO REPRODUCE
Execute the playbook below with the appropriate variable details, and I am keep getting the error "msg": "Datacenter not found", meanwhile the datacenter name does exists.
- hosts: localhost
gather_facts: False
connection: local
tasks:
- name: Instant Clone a VM
community.vmware.vmware_guest_instant_clone:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: False
folder: "/{{ datacenter }}/vm/"
datastore: "{{ rw_datastore }}"
datacenter: "{{ datacenter }}"
host: "{{ esxi_hostname }}"
name: "{{ clone_vm }}"
parent_vm: "{{ parent_vm }}"
resource_pool: "{{ resource_pool }}"
register: vm_clone
delegate_to: localhost
EXPECTED RESULTS
The expected results will be the clone of my target VM is created in my Vcenter in the specified folder.
ACTUAL RESULTS
I am keep getting the error message "msg": "Datacenter not found" when I launch this playbook from my ansible tower and this module is unable to create a clone of my VM in Vcenter.
Files identified in the description: None
If these files are inaccurate, please update the component name section of the description or use the !component bot command.
Hi can anyone help out on this issue please ?
Thanks @yashvanthkumar94 for reporting the issue! I will confirm the same problem whether it does occur in my environment. BTY, could you please tell me your tower version?
Hi @sky-joker,
Thanks for responding, the tower version is 3.8.5-1
I confirmed the module behavior with your playbook code, the folder error occurred not "Datacenter error".
fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": "Folder not found."}
The cause of the error is that the method in the module doesn't support an argument for a full object path.
I'll fix this bug.
Please let me make sure, does the datacenter error still occur now, not "Folder error'?
My Environment Information
- vCenter 7.0.0
- community.vmware latest version
- Ansible Tower 3.8.5-1
- Ansible 2.9.27
@yashvanthkumar94 @appdevytlps Could you please test if #1354 fixes your issue?
@yashvanthkumar94 @appdevytlps Did you find the time yet to test if #1354 fixes your issue?