![ansible vca_vapp AttributeError:“NoneType”对象没有属性“startswith”](https://linux22.com/image/672746/ansible%20vca_vapp%20AttributeError%EF%BC%9A%E2%80%9CNoneType%E2%80%9D%E5%AF%B9%E8%B1%A1%E6%B2%A1%E6%9C%89%E5%B1%9E%E6%80%A7%E2%80%9Cstartswith%E2%80%9D.png)
当在 Ansible 中针对 VCloud 使用 vca_vapp 时,使用示例时出现错误“AttributeError:'NoneType' 对象没有属性 'startswith'”。
TASK [vca_vapp vm_name=myvm3 username={{ username }}
template_name=Ubuntu Server 12.04 LTS (amd6420150127)
vapp_name=myapp instance_id={{ instanceid }} state=present
operation=poweron password={{ admin_pass }} vdc_name=VDC2] ***
An exception occurred during task execution. To see the full
traceback, use -vvv. The error was: AttributeError: 'NoneType'
object has no attribute 'startswith' fatal: [localhost]: FAILED!
=> {"changed": false, "failed": true, "parsed": false}
答案1
解决方案:您需要设置(未记录的)“主机”变量。例如:
- vca_vapp:
host: 'https://vca.vmware.com'
vapp_name: myapp
vm_name: myvm
state: present
operation: poweron
instance_id: "{{ instanceid }}"
参见此拉取请求:https://github.com/ansible/ansible-modules-extras/pull/1355