community.vmware
community.vmware copied to clipboard
Cannot relocate VM to a different datastore
SUMMARY
vmware_guest won't move VM to a different datastore (tested mode "Change storage only")
ISSUE TYPE
- Bug Report
COMPONENT NAME
vmware_guest
ANSIBLE VERSION
ansible 2.9.10
OS / ENVIRONMENT
vSphere 6.7.0.43000
Ansible on Debian 10 (codename Buster)
python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0] (installed from debian repository)
STEPS TO REPRODUCE
ansible-playbook -vvvv mod_datastore.yml --extra-vars "vmintname=worker-c6 storage=internal-54 size=9"
---
- name: Migrate VM to other datastore only
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Migrate VM to other datastore only
vmware_guest:
hostname: vsphere.example.com
username: [email protected]
password: VrScrPsswd
validate_certs: no
folder: /InternalDC/vm/InternalVMs
datacenter: InternalDC
cluster: EktCl
name: "{{ vmintname }}"
disk:
- size_gb: "{{ size }}"
datastore: "{{ storage }}"
delegate_to: localhost
or
ansible-playbook -vvvv mod_datastore.yml --extra-vars "vmintname=worker-c6 storage=internal-54"
- name: Migrate VM to other datastore only
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Migrate VM to other datastore only
vmware_guest:
hostname: vsphere.example.com
username: [email protected]
password: VrScrPsswd
validate_certs: no
folder: /InternalDC/vm/InternalVMs
datacenter: InternalDC
cluster: EktCl
name: "{{ vmintname }}"
datastore: "{{ storage }}"
delegate_to: localhost
EXPECTED RESULTS
- Disk will be migrated to other datastore.
ACTUAL RESULTS
- Disk remains on the initial datastore, no attempts to relocate VM disk and files.
**ansible-playbook 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Set default localhost to localhost
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.7/dist-packages/ansible/plugins/callback/default.py
PLAYBOOK: mod_datastore.yml **************************************************************************************************************************************************************************************
Positional arguments: mod_datastore.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/etc/ansible/hosts',)
extra_vars: ('vmintname=worker-c6 storage=internal-54',)
forks: 5
1 plays in mod_datastore.yml
PLAY [Migrate VM to other datastore only] *************************************************************************************************************************************************
META: ran handlers
TASK [Migrate VM to other datastore only] ***********************************************************************************************************************************************
task path: /root/mod_datastore.yml:7
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir /root/.ansible/tmp/ansible-tmp-1598872328.5940628-26524-256910671555867 && echo ansible-tmp-1598872328.5940628-26524-256910671555867="` echo /root/.ansible/tmp/ansible-tmp-1598872328.5940628-26524-256910671555867 `" ) && sleep 0'
<localhost> Attempting python interpreter discovery
<localhost> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
<localhost> Python interpreter discovery fallback (unsupported Linux distribution: debian)
Using module file /usr/local/lib/python3.7/dist-packages/ansible/modules/cloud/vmware/vmware_guest.py
<localhost> PUT /root/.ansible/tmp/ansible-local-26519mfhan9zx/tmpixo5k9ac TO /root/.ansible/tmp/ansible-tmp-1598872328.5940628-26524-256910671555867/AnsiballZ_vmware_guest.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1598872328.5940628-26524-256910671555867/ /root/.ansible/tmp/ansible-tmp-1598872328.5940628-26524-256910671555867/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1598872328.5940628-26524-256910671555867/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1598872328.5940628-26524-256910671555867/ > /dev/null 2>&1 && sleep 0'
[WARNING]: Platform linux on host localhost is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
ok: [localhost] => {
"changed": false,
"instance": {
"annotation": "",
"current_snapshot": null,
"customvalues": {},
"guest_consolidation_needed": false,
"guest_question": null,
"guest_tools_status": "guestToolsNotRunning",
"guest_tools_version": "10357",
"hw_cluster": "EktCl",
"hw_cores_per_socket": 1,
"hw_datastores": [
"internal-52"
],
"hw_esxi_host": "10.30.20.52",
"hw_eth0": {
"addresstype": "assigned",
"ipaddresses": null,
"label": "Network adapter 1",
"macaddress": "00:50:56:b5:26:59",
"macaddress_dash": "00-50-56-b5-26-59",
"portgroup_key": null,
"portgroup_portkey": null,
"summary": "Lan Segment 0"
},
"hw_files": [
"[internal-52] worker-c6/worker-c6.vmx",
"[internal-52] worker-c6/worker-c6.vmxf",
"[internal-52] worker-c6/worker-c6.nvram",
"[internal-52] worker-c6/worker-c6.vmsd",
"[internal-52] worker-c6/vmware-3.log",
"[internal-52] worker-c6/vmware-2.log",
"[internal-52] worker-c6/vmware-1.log",
"[internal-52] worker-c6/vmware.log",
"[internal-52] worker-c6/vmware-6.log",
"[internal-52] worker-c6/vmware-5.log",
"[internal-52] worker-c6/vmware-4.log",
"[internal-52] worker-c6/worker-c6.vmdk"
],
"hw_folder": "/InternalDC/vm/LAN Segment 0",
"hw_guest_full_name": null,
"hw_guest_ha_state": null,
"hw_guest_id": null,
"hw_interfaces": [
"eth0"
],
"hw_is_template": false,
"hw_memtotal_mb": 1024,
"hw_name": "worker-c6",
"hw_power_status": "poweredOff",
"hw_processor_count": 1,
"hw_product_uuid": "42350c57-78e6-01b9-fbc6-028f5ddbd573",
"hw_version": "vmx-11",
"instance_uuid": "5035394b-136c-b3be-6477-cbf130cc9d5c",
"ipv4": null,
"ipv6": null,
"module_hw": true,
"moid": "vm-790",
"snapshots": [],
"vimref": "vim.VirtualMachine:vm-790",
"vnc": {}
},
"invocation": {
"module_args": {
"annotation": null,
"cdrom": [],
"cluster": "EktCl",
"convert": null,
"customization": {},
"customization_spec": null,
"customvalues": [],
"datacenter": "InternalDC",
"datastore": "internal-54",
"disk": [],
"esxi_hostname": null,
"folder": "/InternalDC/vm/InternalVMs",
"force": false,
"guest_id": null,
"hardware": {},
"hostname": "vsphere.example.com",
"is_template": false,
"linked_clone": false,
"name": "worker-c6",
"name_match": "first",
"networks": [],
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"proxy_host": null,
"proxy_port": null,
"resource_pool": null,
"snapshot_src": null,
"state": "present",
"state_change_timeout": 0,
"template": null,
"use_instance_uuid": false,
"username": "[email protected]",
"uuid": null,
"validate_certs": false,
"vapp_properties": [],
"wait_for_customization": false,
"wait_for_ip_address": false
}
}
}
META: ran handlers
META: ran handlers
PLAY RECAP *********************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Files identified in the description:
If these files are inaccurate, please update the component name section of the description or use the !component bot command.
cc @Akasurde @Tomorrow9 @goneri @lparkes @nerzhul @pdellaert @pgbidkar @warthog9 click here for bot help
Files identified in the description:
- [
plugins/modules/vmware_guest.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/vmware_guest.py)
If these files are inaccurate, please update the component name section of the description or use the !component bot command.
@zeph-rpulse Thanks for reporting this issue. I would see this as a new module where you can relocate the existing VM based upon the user-provided values.
Feel free to engage and raise a PR. Thanks.
@Akasurde Could you help me with this issue?
We want to relocate ( change disk datastore) using vpshere. Vm has 3 different disks and these 3 disks have 3 different datastore.
Hi. There is still no possibility to relocate vm disk to new datastore. My VMs has more than one disks. and they have to be located on a different datastores.