【问题标题】:Pysphere error when running playbook运行 playbook 时出现 Pysphere 错误
【发布时间】:2016-08-31 23:38:43
【问题描述】:
---
- hosts: my-host
  tasks:
    - vsphere_guest:
        vcenter_hostname: vcenter.mydomain.local
        username: myuser
        password: mypass
        guest: newvm001
        vmware_guest_facts: yes

当我运行这个剧本时,我得到了这个错误

播放 [我的主机]


任务 [设置] ****************************************************** ***************** 好的:[19.3.112.97]

任务 [vsphere_guest] ****************************************************** ********* 致命:[19.3.112.97]:失败! => {“改变”:假,“失败”:真,“味精”: “需要 pysphere 模块”}

没有更多的主机了 ****************************************************** *********** [警告]:无法创建重试文件“createvms.retry”。
[Errno 2] 没有这样的文件或目录:''

播放回顾


19.3.112.97 : ok=1 changed=0 unreachable=0 failed=1

为什么会出现此错误?我已经卸载并安装了 pysphere。我已经使用过它的以前和当前版本,但我仍然收到此错误。

【问题讨论】:

  • 你在控制主机上安装了psyphere?怎么样?
  • 我使用了 pip install。 'sudo pip install pysphere'
  • 我最初的想法是你的系统上安装了多个 python,而 Ansible 使用了“错误”的一个。
  • 这是有道理的。让我进一步研究一下,看看是否是这样。谢谢
  • @mwp 什么是数据中心?以及如何使用正确的数据中心?谢谢

标签: yaml ansible ansible-playbook pysphere


【解决方案1】:

您通常希望从您的控制机器 (localhost) 运行云/VM 管理模块。 这看起来像这样:

---
- hosts: localhost
  connection: local
  tasks:
    - vsphere_guest:
        vcenter_hostname: vcenter.mydomain.local
        username: myuser
        password: mypass
        guest: newvm001
        vmware_guest_facts: yes

在这种情况下,可以使用安装在控制主机上的 PySphere 连接到 vcenter.mydomain.local 并配置 VM。

在您的示例中,PySphere 应该安装在 19.3.112.97 上,并且应该可以从该主机访问 vcenter.mydomain.local

【讨论】:

  • 你好。什么是数据中心?以及如何使用正确的数据中心?谢谢
猜你喜欢
  • 2022-06-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-10
  • 1970-01-01
  • 2021-06-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多