Python os_网络参数列表上的ansible抛出错误

Python os_网络参数列表上的ansible抛出错误,python,ansible,Python,Ansible,我们已经在ubuntu 14.04中安装了ansible 2.1.0版 在使用os_网络模块时,我们遇到此错误 root@ubuntu:/home/admin-nfv/Nuage_Automation/nuage_vm_creation/playbooks# ansible-playbook create_or_delete_network.yml [WARNING]: provided hosts list is empty, only localhost is available PL

我们已经在ubuntu 14.04中安装了ansible 2.1.0版

在使用os_网络模块时,我们遇到此错误

root@ubuntu:/home/admin-nfv/Nuage_Automation/nuage_vm_creation/playbooks# ansible-playbook create_or_delete_network.yml
 [WARNING]: provided hosts list is empty, only localhost is available


PLAY [Create Network] **********************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [create_network : create or delete network] *******************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: create_network() takes at most 4 arguments (7 given)
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_crfy0P/ansible_module_os_network.py\", line 247, in <module>\n    main()\n  File \"/tmp/ansible_crfy0P/ansible_module_os_network.py\", line 226, in main\n    external, provider, project_id)\nTypeError: create_network() takes at most 4 arguments (7 given)\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}

NO MORE HOSTS LEFT *************************************************************
        to retry, use: --limit @create_or_delete_network.retry

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

在另一台机器上,相同的代码工作时没有任何错误。但不确定环境出了什么问题

Ansible在
os_网络
模块内使用
shade
pip包。该软件包内部的接口,尤其是
create\u network
方法的接口在最新版本中发生了更改,而ansible的新版本现在依赖于新功能

您应该确保在ansible主机上使用最新版本,目前为1.9.0

pip install shade==1.9.0
- name: create or delete network
  os_network:
    auth:
      auth_url: "http://1.2.3.4:35357/v2.0"
      username: "admin"
      password: "xxxxxxx"
      project_name: "admin"
    state: "present"
    name: "Test"
    external: true
pip install shade==1.9.0