Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmware_content_deploy_template fails with error "Cannot find service 'com.vmware.vcenter.vm_template.library_items'" #182

Closed
dfoley84-zz opened this issue May 15, 2020 · 5 comments
Assignees
Labels
affects_2.10 traceback verified This issue has been verified/reproduced by maintainer waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@dfoley84-zz
Copy link

dfoley84-zz commented May 15, 2020

SUMMARY

I'm Trying to Deploy a Virtual Machine on a Test Cluster from a Template which is hosted on VMware Content Library

ISSUE TYPE

Cannot find service 'com.vmware.vcenter.vm_template.library_items

COMPONENT NAME
ANSIBLE VERSION
2.9.9
OS / ENVIRONMENT

Linux Ubunutu 18.04

STEPS TO REPRODUCE
---
- hosts: localhost
  gather_facts: false
  tasks:
  - name: Deploy Virtual Machine from template in content library
    vmware_content_deploy_template:
      hostname: "{{ Host }}"
      username: "{{ user }}"
      password: "{{ pass }}"
      template: "{{ Template }}" 
      datastore: "{{ datastore }}"
      folder: /vm
      datacenter: "{{ DC }}"
      host: "{{ ESXi }}"
      name: Test_Machine
      validate_certs: False
      state: present
    delegate_to: localhost
EXPECTED RESULTS

Expected "Success"
{'msg': "Deployed Virtual Machine 'Sample_VM'.", 'vm_id': 'vm-1009'}

ACTUAL RESULTS
ansible-playbook t.yaml -vvvvv

ansible-playbook 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.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
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc

PLAYBOOK: t.yaml **********************************************************************************************************************************************************************************************************************Positional arguments: t.yaml
become_method: sudo
inventory: (u'/etc/ansible/hosts',)
forks: 5
tags: (u'all',)
verbosity: 5
connection: smart
timeout: 10
1 plays in t.yaml

PLAY [localhost] **********************************************************************************************************************************************************************************************************************META: ran handlers

TASK [Deploy Virtual Machine from template in content library] ************************************************************************************************************************************************************************task path: /srv/ansible/t.yaml:5
<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-1589555313.13-6894-196031450684677 && echo ansible-tmp-1589555313.13-6894-196031450684677="` echo /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677 `" ) && sleep 0'
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/_text.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/vmware.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/vmware_rest_client.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/basic.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/six/__init__.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/urls.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/_collections_compat.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/__init__.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/formatters.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/validation.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/converters.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/pycompat24.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/text/__init__.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/process.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/parsing/convert_bool.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/_utils.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/parameters.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/parsing/__init__.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/_json_compat.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/sys_info.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/file.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/common/collections.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/distro/__init__.py
Using module_utils file /usr/lib/python2.7/dist-packages/ansible/module_utils/distro/_distro.py
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/cloud/vmware/vmware_content_deploy_template.py
<localhost> PUT /root/.ansible/tmp/ansible-local-6887q_iAgx/tmpOMKInk TO /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/AnsiballZ_vmware_content_deploy_template.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/ /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/AnsiballZ_vmware_content_deploy_template.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/AnsiballZ_vmware_content_deploy_template.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost -> localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\nTraceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/AnsiballZ_vmware_content_deploy_template.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/AnsiballZ_vmware_content_deploy_template.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1589555313.13-6894-196031450684677/AnsiballZ_vmware_content_deploy_template.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.cloud.vmware.vmware_content_deploy_template', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n    mod_name, mod_fname, mod_loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_vmware_content_deploy_template_payload_F5VGf7/ansible_vmware_content_deploy_template_payload.zip/ansible/modules/cloud/vmware/vmware_content_deploy_template.py\", line 271, in <module>\n  File \"/tmp/ansible_vmware_content_deploy_template_payload_F5VGf7/ansible_vmware_content_deploy_template_payload.zip/ansible/modules/cloud/vmware/vmware_content_deploy_template.py\", line 258, in main\n  File \"/tmp/ansible_vmware_content_deploy_template_payload_F5VGf7/ansible_vmware_content_deploy_template_payload.zip/ansible/modules/cloud/vmware/vmware_content_deploy_template.py\", line 209, in deploy_vm_from_template\n  File \"/usr/local/lib/python2.7/dist-packages/com/vmware/vcenter/vm_template_client.py\", line 2110, in deploy\n    'spec': spec,\n  File \"/usr/local/lib/python2.7/dist-packages/vmware/vapi/bindings/stub.py\", line 345, in _invoke\n    return self._api_interface.native_invoke(ctx, _method_name, kwargs)\n  File \"/usr/local/lib/python2.7/dist-packages/vmware/vapi/bindings/stub.py\", line 298, in native_invoke\n    self._rest_converter_mode)\ncom.vmware.vapi.std.errors_client.OperationNotFound: {error_type : None, messages : [LocalizableMessage(default_message=\"Cannot find service 'com.vmware.vcenter.vm_template.library_items'.\", args=['com.vmware.vcenter.vm_template.library_items'], params=None, id='vapi.method.input.invalid.interface', localized=None)], data : None}\n/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

PLAY RECAP ****************************************************************************************************************************************************************************************************************************localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0


@Akasurde Akasurde changed the title Content Library vmware_content_deploy_template fails with error "Cannot find service 'com.vmware.vcenter.vm_template.library_items'" May 16, 2020
@Akasurde
Copy link
Member

@dfoley84 What is the version of vCenter used in the playbook? Since this VMware feature is vCenter version-specific.

needs_info

@dfoley84-zz
Copy link
Author

Version of vCenter is 6.5

@Akasurde
Copy link
Member

@dfoley84 Module vmware_content_deploy_template does not support 6.5. Please update vCenter version to 6.7U3 or latest.

@Akasurde Akasurde self-assigned this May 26, 2020
@Akasurde Akasurde added verified This issue has been verified/reproduced by maintainer waiting_on_contributor Needs help. Feel free to engage to get things unblocked labels May 26, 2020
@Akasurde
Copy link
Member

@dfoley84 I added stub to handle the exception raised in this scenario - #209.

@Akasurde
Copy link
Member

@dfoley84 Did you try this on 6.7 and onwards? Do you still get this error? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.10 traceback verified This issue has been verified/reproduced by maintainer waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
Development

No branches or pull requests

3 participants