{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/40637","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/40637/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/40637/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/40637/events","html_url":"https://github.com/ansible/ansible/issues/40637","id":325876036,"node_id":"MDU6SXNzdWUzMjU4NzYwMzY=","number":40637,"title":"vmware_guest tries to customize the VM when using the networks parameter.","user":{"login":"ProfessorDub","id":16961807,"node_id":"MDQ6VXNlcjE2OTYxODA3","avatar_url":"https://avatars1.githubusercontent.com/u/16961807?v=4","gravatar_id":"","url":"https://api.github.com/users/ProfessorDub","html_url":"https://github.com/ProfessorDub","followers_url":"https://api.github.com/users/ProfessorDub/followers","following_url":"https://api.github.com/users/ProfessorDub/following{/other_user}","gists_url":"https://api.github.com/users/ProfessorDub/gists{/gist_id}","starred_url":"https://api.github.com/users/ProfessorDub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProfessorDub/subscriptions","organizations_url":"https://api.github.com/users/ProfessorDub/orgs","repos_url":"https://api.github.com/users/ProfessorDub/repos","events_url":"https://api.github.com/users/ProfessorDub/events{/privacy}","received_events_url":"https://api.github.com/users/ProfessorDub/received_events","type":"User","site_admin":false},"labels":[{"id":686214011,"node_id":"MDU6TGFiZWw2ODYyMTQwMTE=","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.5","name":"affects_2.5","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":61528803,"node_id":"MDU6TGFiZWw2MTUyODgwMw==","url":"https://api.github.com/repos/ansible/ansible/labels/cloud","name":"cloud","color":"c7def8","default":false},{"id":496359346,"node_id":"MDU6TGFiZWw0OTYzNTkzNDY=","url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":54811101,"node_id":"MDU6TGFiZWw1NDgxMTEwMQ==","url":"https://api.github.com/repos/ansible/ansible/labels/needs_info","name":"needs_info","color":"eb6420","default":false},{"id":636327968,"node_id":"MDU6TGFiZWw2MzYzMjc5Njg=","url":"https://api.github.com/repos/ansible/ansible/labels/support:community","name":"support:community","color":"ededed","default":false},{"id":427121291,"node_id":"MDU6TGFiZWw0MjcxMjEyOTE=","url":"https://api.github.com/repos/ansible/ansible/labels/vmware","name":"vmware","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-05-23T21:14:50Z","updated_at":"2018-08-22T15:04:29Z","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\nvmware_guest tries to customize the VM when using the networks parameter even without optionnal parameters used for OS customization.\r\nThe error that appears is \"Failed to create a virtual machine : Customization of the guest operating system 'rhel7_64Guest' is not supported in this configuration. Microsoft Vista (TM) and Linux guests with Logical Volume Manager are supported only for recent ESX host and VMware Tools versions. Refer to vCenter documentation for supported configurations.\"\r\n\r\n##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nvmware_guest \r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste, BELOW THIS COMMENT, verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\nansible 2.5.3\r\n  config file = None\r\n  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /usr/lib/python2.7/site-packages/ansible\r\n  executable location = /usr/bin/ansible\r\n  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]\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\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\nInstalled via pip on CentOS Linux release 7.4.1708 (Core)\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- name: \"Cloning the template\"\r\n  vmware_guest:\r\n    hostname: \"vcenter.lab\"\r\n    username: \"user@lab\"\r\n    password: \"\"\r\n    validate_certs: no\r\n    esxi_hostname: \"esx.lab\"\r\n    datacenter: \"DCLAB\"\r\n    folder: \"/folder\"\r\n    name: \"test\"\r\n    template: \"RHEL_tpl\"\r\n    hardware:\r\n      memory_mb: \"1024\"\r\n      num_cpus: \"1\"\r\n    networks:\r\n    - name: \"DPG_Network\"\r\n    disk:\r\n    - size_gb: 32\r\n      type: thick\r\n      autoselect_datastore: yes\r\n    - size_gb: 16\r\n      type: thick\r\n      autoselect_datastore: yes\r\n    - size_gb: 32\r\n      type: thick\r\n      autoselect_datastore: yes\r\n    state: present\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\nThe cloned VM with the good network, and no errors.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\nThe VM is cloned and the network is good, but Ansible fails when trying to customize the OS.\r\n\r\nThe error is located at vmware_guest.py, lines 940 to 947, in the sanitize_network_params function.\r\n\r\n```python\r\n else:\r\n     # Type is optional parameter, if user provided IP or Subnet assume\r\n     # network type as 'static'\r\n     if 'ip' in network or 'netmask' in network:\r\n         network['type'] = 'static'\r\n     else:\r\n         # User wants network type as 'dhcp'\r\n         network['type'] = 'dhcp'\r\n```\r\n\r\nWhatever happens before, the network['type'] is still setted at 'dhcp', even if I only use \"name\" or \"vlan\". You can see below the request sent to the vCenter contains the type 'dhcp' :\r\n\r\n```\r\n            \"networks\": [\r\n                {\r\n                    \"name\": \"DPG_Network\",\r\n                    \"type\": \"dhcp\"\r\n                }\r\n```\r\n\r\nAnd then when network['type'] is not null, customize_vm is called and tries to do it's job on my template which doesn't want to be customized :)\r\n\r\nLines 1639 => 1648 :\r\n\r\n```python\r\nnetwork_changes = False\r\nfor nw in self.params['networks']:\r\n    for key in nw:\r\n        # We don't need customizations for these keys\r\n        if key not in ('device_type', 'mac', 'name', 'vlan'):\r\n            network_changes = True\r\n            break\r\n\r\nif len(self.params['customization']) > 0 or network_changes is True:\r\n    self.customize_vm(vm_obj=vm_obj)\r\n```\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\nfatal: [127.0.0.1]: FAILED! => {\r\n    \"changed\": false,\r\n    \"invocation\": {\r\n        \"module_args\": {\r\n            \"annotation\": null,\r\n            \"cdrom\": {},\r\n            \"cluster\": null,\r\n            \"customization\": {},\r\n            \"customvalues\": [],\r\n            \"datacenter\": \"DCLAB\",\r\n            \"disk\": [\r\n                {\r\n                    \"autoselect_datastore\": true,\r\n                    \"size_gb\": 32,\r\n                    \"type\": \"thick\"\r\n                },\r\n                {\r\n                    \"autoselect_datastore\": true,\r\n                    \"size_gb\": 16,\r\n                    \"type\": \"thick\"\r\n                },\r\n                {\r\n                    \"autoselect_datastore\": true,\r\n                    \"size_gb\": 32,\r\n                    \"type\": \"thick\"\r\n                }\r\n            ],\r\n            \"esxi_hostname\": \"esx.lab\",\r\n            \"folder\": \"/folder\",\r\n            \"force\": false,\r\n            \"guest_id\": null,\r\n            \"hardware\": {\r\n                \"memory_mb\": \"1024\",\r\n                \"num_cpus\": \"1\"\r\n            },\r\n            \"hostname\": \"vcenter.lab\",\r\n            \"is_template\": false,\r\n            \"linked_clone\": false,\r\n            \"name\": \"test\",\r\n            \"name_match\": \"first\",\r\n            \"networks\": [\r\n                {\r\n                    \"name\": \"DPG_Network\",\r\n                    \"type\": \"dhcp\"\r\n                }\r\n            ],\r\n            \"password\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\",\r\n            \"port\": 443,\r\n            \"resource_pool\": null,\r\n            \"snapshot_src\": null,\r\n            \"state\": \"present\",\r\n            \"template\": \"RHEL_tpl\",\r\n            \"username\": \"user@lab\",\r\n            \"uuid\": null,\r\n            \"validate_certs\": false,\r\n            \"wait_for_ip_address\": false\r\n        }\r\n    },\r\n    \"msg\": \"Failed to create a virtual machine : Customization of the guest operating system 'rhel7_64Guest' is not supported in this configuration. Microsoft Vista (TM) and Linux guests with Logical Volume Manager are supported only for recent ESX host and VMware Tools versions. Refer to vCenter documentation for supported configurations.\"\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/415065036","html_url":"https://github.com/ansible/ansible/issues/40637#issuecomment-415065036","issue_url":"https://api.github.com/repos/ansible/ansible/issues/40637","id":415065036,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTA2NTAzNg==","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-08-22T15:04:29Z","updated_at":"2018-08-22T15:04:29Z","author_association":"MEMBER","body":"@morla10111 `start_connected` is addressed in this PR https://github.com/ansible/ansible/pull/40990"}}
{"actor":{"display_login":"Akasurde"}}