{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/42084","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/42084/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/42084/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/42084/events","html_url":"https://github.com/ansible/ansible/issues/42084","id":336824259,"node_id":"MDU6SXNzdWUzMzY4MjQyNTk=","number":42084,"title":"vmware_guest \"rename a vm\" example doesn't work from the documentation","user":{"login":"jacksonp2008","id":1813327,"node_id":"MDQ6VXNlcjE4MTMzMjc=","avatar_url":"https://avatars1.githubusercontent.com/u/1813327?v=4","gravatar_id":"","url":"https://api.github.com/users/jacksonp2008","html_url":"https://github.com/jacksonp2008","followers_url":"https://api.github.com/users/jacksonp2008/followers","following_url":"https://api.github.com/users/jacksonp2008/following{/other_user}","gists_url":"https://api.github.com/users/jacksonp2008/gists{/gist_id}","starred_url":"https://api.github.com/users/jacksonp2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacksonp2008/subscriptions","organizations_url":"https://api.github.com/users/jacksonp2008/orgs","repos_url":"https://api.github.com/users/jacksonp2008/repos","events_url":"https://api.github.com/users/jacksonp2008/events{/privacy}","received_events_url":"https://api.github.com/users/jacksonp2008/received_events","type":"User","site_admin":false},"labels":[{"id":835286067,"node_id":"MDU6TGFiZWw4MzUyODYwNjc=","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.6","name":"affects_2.6","color":"ededed","default":false},{"id":785271699,"node_id":"MDU6TGFiZWw3ODUyNzE2OTk=","url":"https://api.github.com/repos/ansible/ansible/labels/bug","name":"bug","color":"fbca04","default":true},{"id":636352796,"node_id":"MDU6TGFiZWw2MzYzNTI3OTY=","url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-29T00:33:04Z","updated_at":"2018-06-29T08:02:20Z","closed_at":null,"author_association":"NONE","body":"<!---\r\nVerify first that your issue/request is not already reported on GitHub.\r\nTHIS FORM WILL BE READ BY A MACHINE, COMPLETE ALL SECTIONS AS DESCRIBED.\r\nAlso test if the latest release, and devel branch are affected too.\r\nALWAYS add information AFTER (OUTSIDE) these html comments.\r\nOtherwise it may end up being automatically closed by our bot. -->\r\n\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\nvmware_guest \"rename a vm\" example doesn't work from the documentation\r\n\r\nSee the example here:  https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html#vmware-guest-module\r\n\r\n##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Insert, BELOW THIS COMMENT, the name of the module, plugin, task or feature.\r\nDo not include extra details here, e.g. \"vyos_command\" not \"the network module vyos_command\" or the full path-->\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste, BELOW THIS COMMENT, verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\nca-spollockmb1:fs-vmw-control spollock$ ansible --version\r\nansible 2.6.0\r\n  config file = /Users/spollock/ansible/fs-vmw-control/ansible.cfg\r\n  configured module search path = [u'/Users/spollock/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /Library/Python/2.7/site-packages/ansible\r\n  executable location = /usr/local/bin/ansible\r\n  python version = 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]\r\n\r\n```\r\n\r\n##### CONFIGURATION\r\n<!--- If using Ansible 2.4 or above, paste, BELOW THIS COMMENT, the results of \"ansible-config dump --only-changed\"\r\nOtherwise, mention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).-->\r\nca-spollockmb1:fs-vmw-control spollock$ ansible-config dump --only-changed\r\nDEFAULT_HOST_LIST(/Users/spollock/ansible/fs-vmw-control/ansible.cfg) = [u'/Users/spollock/ansible/fs-\r\nDEFAULT_REMOTE_PORT(/Users/spollock/ansible/fs-vmw-control/ansible.cfg) = 22\r\nDEFAULT_REMOTE_USER(/Users/spollock/ansible/fs-vmw-control/ansible.cfg) = spollock\r\nDEFAULT_TIMEOUT(/Users/spollock/ansible/fs-vmw-control/ansible.cfg) = 30\r\nRETRY_FILES_ENABLED(/Users/spollock/ansible/fs-vmw-control/ansible.cfg) = False\r\n(END)\r\n\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Mention, BELOW THIS COMMENT, the OS you are running Ansible from, and the OS you are\r\nmanaging, or say \"N/A\" for anything that is not platform-specific.\r\nAlso mention the specific version of what you are trying to control,\r\ne.g. if this is a network bug the version of firmware on the network device.-->\r\nca-spollockmb1:fs-vmw-control spollock$ system_profiler SPSoftwareDataType\r\nSoftware:\r\n\r\n    System Software Overview:\r\n\r\n      System Version: OS X 10.11.6 (15G20015)\r\n      Kernel Version: Darwin 15.6.0\r\n      Boot Volume: Macintosh HD\r\n      Boot Mode: Normal\r\n      Computer Name: ca-spollockmb1\r\n      User Name: Steven Pollock (spollock)\r\n      Secure Virtual Memory: Enabled\r\n      System Integrity Protection: Enabled\r\n      Time since boot: 1 day 8:22\r\n\r\nvCenter/ESX 6.5\r\n\r\n##### STEPS TO REPRODUCE\r\n<!--- For bugs, show exactly how to reproduce the problem, using a minimal test-case.\r\nFor new features, show how the feature would be used. -->\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n\r\nThe vars of interest:\r\nvcprepvmname: \"moveme-CHKP-VM1\"\r\nvcpreptargetname: \"1766-chkp-vm1\"\r\n\r\n- name: grab the machine uuid\r\n  vmware_guest_facts:\r\n    validate_certs: no\r\n    hostname: \"{{ vcenterhostname }}\"\r\n    username: \"{{ vcusername }}\"\r\n    password: \"{{ vcpassword }}\"\r\n    datacenter: \"{{ vcdatacenter }}\"\r\n    folder: \"{{ vcfolder }}\"\r\n    name: \"{{ vcprepvmname }}\"\r\n  delegate_to: localhost\r\n  register: vmfacts\r\n  tags: prep1\r\n\r\n- name: rename the VM\r\n  vmware_guest:\r\n    validate_certs: no\r\n    hostname: \"{{ vcenterhostname }}\"\r\n    username: \"{{ vcusername }}\"\r\n    password: \"{{ vcpassword }}\"\r\n    datacenter: \"{{ vcdatacenter }}\"\r\n    cluster: \"{{ vccluster }}\"\r\n    folder: \"{{ vcfolder }}\"\r\n    uuid: \"{{ vmfacts.instance.instance_uuid }}\"\r\n    name: \"{{ vcpreptargetname }}\"\r\n    state: present\r\n  delegate_to: localhost\r\n  tags: prep1\r\n\r\n```\r\n\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\n\r\nAccording to the documentation it should simply rename the guest.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\nPLAY [Prep Kit Machine] ******************************************************************************\r\n\r\nTASK [prepkitvm : grab the machine uuid] *************************************************************\r\nok: [localhost -> localhost]\r\n\r\nTASK [prepkitvm : rename the VM] *********************************************************************\r\nfatal: [localhost -> localhost]: FAILED! => {\"changed\": false, \"msg\": \"Unable to find the datastore with given parameters. This could mean, 1766-chkp-vm1 is a non-existent virtual machine and module tried to deploy it as new virtual machine with no disk. Please specify disks parameter or specify template to clone from.\"}\r\n\r\nPLAY RECAP *******************************************************************************************\r\nlocalhost                  : ok=1    changed=0    unreachable=0    failed=1   \r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/401280128","html_url":"https://github.com/ansible/ansible/issues/42084#issuecomment-401280128","issue_url":"https://api.github.com/repos/ansible/ansible/issues/42084","id":401280128,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTI4MDEyOA==","user":{"login":"Akasurde","id":633765,"node_id":"MDQ6VXNlcjYzMzc2NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/633765?v=4","gravatar_id":"","url":"https://api.github.com/users/Akasurde","html_url":"https://github.com/Akasurde","followers_url":"https://api.github.com/users/Akasurde/followers","following_url":"https://api.github.com/users/Akasurde/following{/other_user}","gists_url":"https://api.github.com/users/Akasurde/gists{/gist_id}","starred_url":"https://api.github.com/users/Akasurde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Akasurde/subscriptions","organizations_url":"https://api.github.com/users/Akasurde/orgs","repos_url":"https://api.github.com/users/Akasurde/repos","events_url":"https://api.github.com/users/Akasurde/events{/privacy}","received_events_url":"https://api.github.com/users/Akasurde/received_events","type":"User","site_admin":false},"created_at":"2018-06-29T08:02:20Z","updated_at":"2018-06-29T08:02:20Z","author_association":"MEMBER","body":"@jacksonp2008 Thanks for reporting this issue. I see you are using `instance_uuid ` instead of `hw_product_uuid` \r\n\r\n```yaml\r\n---\r\n- name: issue_42084\r\n  gather_facts: no\r\n  vars_files:\r\n    - vcenter_vars.yml\r\n  vars:\r\n    ansible_python_interpreter: \"/usr/bin/env python3\"\r\n  hosts: localhost\r\n  tasks:\r\n    - set_fact:\r\n        vm_name: \"new_u0001\"\r\n        new_vm_name: \"rename_new_u0001\"\r\n        datacenter: \"DC1\"\r\n\r\n    - name: Get VM \"{{ vm_name }}\" uuid\r\n      vmware_guest_facts:\r\n        hostname: \"{{ vcenter_server }}\"\r\n        username: \"{{ vcenter_user }}\"\r\n        password: \"{{ vcenter_pass }}\"\r\n        validate_certs: no\r\n        datacenter: \"{{ datacenter }}\"\r\n        folder: \"/{{datacenter}}/vm\"\r\n        name: \"{{ vm_name }}\"\r\n      register: vm_facts\r\n\r\n    - name: Rename \"{{ vm_name }}\" to \"{{ new_vm_name }}\"\r\n      vmware_guest:\r\n        hostname: \"{{ vcenter_server }}\"\r\n        username: \"{{ vcenter_user }}\"\r\n        password: \"{{ vcenter_pass }}\"\r\n        validate_certs: no\r\n        cluster: \"DC1_C1\"\r\n        uuid: \"{{ vm_facts.instance.hw_product_uuid }}\"\r\n        name: \"{{ new_vm_name }}\"\r\n      delegate_to: localhost\r\n      register: facts\r\n```\r\n\r\nconsole log\r\n```\r\n# ansible-playbook rename_vm.yml -v\r\nPLAY [issue_42084] ******************************************************************************************************************\r\n\r\nTASK [set_fact] ****************************************************************************************************************\r\nok: [localhost] => {\"ansible_facts\": {\"datacenter\": \"DC1\", \"new_vm_name\": \"rename_new_u0001\", \"vm_name\": \"new_u0001\"}, \"changed\": false}\r\n\r\nTASK [Get VM \"new_u0001\" uuid] *************************************************************************************************\r\nok: [localhost] => {\"changed\": false, \"instance\": {\"annotation\": \"\", \"current_snapshot\": null, \"customvalues\": {}, \"guest_consolidation_needed\": false, \"guest_question\": null, \"guest_tools_status\": \"guestToolsNotRunning\", \"guest_tools_version\": \"10247\", \"hw_cores_per_socket\": 1, \"hw_datastores\": [\"ds_204_2\"], \"hw_esxi_host\": \"10.76.33.204\", \"hw_eth0\": {\"addresstype\": \"assigned\", \"ipaddresses\": [], \"label\": \"Network adapter 1\", \"macaddress\": \"00:50:56:8c:b8:42\", \"macaddress_dash\": \"00-50-56-8c-b8-42\", \"portgroup_key\": \"dvportgroup-31\", \"portgroup_portkey\": \"15\", \"summary\": \"DVSwitch: 50 0c 3a 69 df 78 2c 7b-6e 08 0a 89 e3 a6 31 17\"}, \"hw_files\": [\"[ds_204_2] u0001/u0001.vmx\", \"[ds_204_2] u0001/u0001.nvram\", \"[ds_204_2] u0001/u0001.vmsd\", \"[ds_204_2] u0001/vmware.log\", \"[ds_204_2] u0001/u0001.vmdk\"], \"hw_folder\": \"/DC1/vm\", \"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\": \"new_u0001\", \"hw_power_status\": \"poweredOff\", \"hw_processor_count\": 1, \"hw_product_uuid\": \"420cbebb-835b-980b-7050-8aea9b7b0a6d\", \"hw_version\": \"vmx-13\", \"instance_uuid\": \"500c60a6-b7b4-8ae5-970f-054905246a6f\", \"ipv4\": null, \"ipv6\": null, \"module_hw\": true, \"snapshots\": []}}\r\n\r\nTASK [Rename \"new_u0001\" to \"rename_new_u0001\"] ********************************************************************************\r\nchanged: [localhost -> localhost] => {\"changed\": true, \"instance\": {\"annotation\": \"\", \"current_snapshot\": null, \"customvalues\": {}, \"guest_consolidation_needed\": false, \"guest_question\": null, \"guest_tools_status\": \"guestToolsNotRunning\", \"guest_tools_version\": \"10247\", \"hw_cores_per_socket\": 1, \"hw_datastores\": [\"ds_204_2\"], \"hw_esxi_host\": \"10.76.33.204\", \"hw_eth0\": {\"addresstype\": \"assigned\", \"ipaddresses\": [], \"label\": \"Network adapter 1\", \"macaddress\": \"00:50:56:8c:b8:42\", \"macaddress_dash\": \"00-50-56-8c-b8-42\", \"portgroup_key\": \"dvportgroup-31\", \"portgroup_portkey\": \"15\", \"summary\": \"DVSwitch: 50 0c 3a 69 df 78 2c 7b-6e 08 0a 89 e3 a6 31 17\"}, \"hw_files\": [\"[ds_204_2] u0001/u0001.vmx\", \"[ds_204_2] u0001/u0001.nvram\", \"[ds_204_2] u0001/u0001.vmsd\", \"[ds_204_2] u0001/vmware.log\", \"[ds_204_2] u0001/u0001.vmdk\"], \"hw_folder\": \"/DC1/vm\", \"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\": \"rename_new_u0001\", \"hw_power_status\": \"poweredOff\", \"hw_processor_count\": 1, \"hw_product_uuid\": \"420cbebb-835b-980b-7050-8aea9b7b0a6d\", \"hw_version\": \"vmx-13\", \"instance_uuid\": \"500c60a6-b7b4-8ae5-970f-054905246a6f\", \"ipv4\": null, \"ipv6\": null, \"module_hw\": true, \"snapshots\": []}}\r\n\r\nPLAY RECAP *********************************************************************************************************************\r\nlocalhost                  : ok=3    changed=1    unreachable=0    failed=0\r\n```\r\n\r\nneeds_info"}}
{"actor":{"display_login":"Akasurde"}}