ansible vca_vapp AttributeError:“NoneType”对象没有属性“startswith”

ansible vca_vapp AttributeError:“NoneType”对象没有属性“startswith”

当在 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

相关内容