gpt4 book ai didi

python - 安塞 bool + 10.11.6

转载 作者:行者123 更新时间:2023-12-02 09:30:06 25 4
gpt4 key购买 nike

我在(非常)干净地安装 10.11.6 时遇到了 Ansible 的奇怪问题。我已经安装了brew、zsh、oh-my-zsh、Lil' snitch 和1password(实际上没有安装其他任何东西)。我安装了ansible...

brew 安装 ansible

...成功了。然后我去了一个预先存在的(而且非常简单)Ansible 项目并做了一个......

ansible -m ping all

然后它要求我输入 SSH 密码。我已经恢复了之前安装的 key ,但之前没有通过 ssh 连接到服务器。我输入了密码,ansible 返回了...

$ ansible -m ping all               
host1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh.",
"unreachable": true
}

然后我通过 ssh 连接到服务器来检查一切是否正常,并且连接没有任何问题。

然后我重新运行...

$ ansible -m ping all

它回来了...

host1 | FAILED! => {
"changed": false,
"failed": true,
"module_stderr": "",
"module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n",
"msg": "MODULE FAILURE",
"parsed": false
}

...这有点奇怪吗?似乎是说它再也找不到 python 了,尽管它第一次找到了它?

$ which python 返回 /usr/bin/python

$ python --version 返回 Python 2.7.10

$ which ansible 返回 /usr/local/bin/ansible

$ ansible --version 返回

ansible 2.1.1.0
config file = /pathtoproject/ansible.cfg
configured module search path = Default w/o overrides

我故意不安装 pyenv、virtualenv 等。

/usr/bin/python 肯定在那里,我可以毫无问题地运行 python。

帮忙?! :-) 我是一名 Ruby 开发人员,我情不自禁地认为我错过了一些明显的东西,但据我了解,所有版本都已检查完毕,并且一切都应该正常工作。我尝试将 shell 更改为 sh 并重新运行 ansible -m ping all 但它以同样的方式失败。

有什么想法吗?

最佳答案

如果远程主机上没有安装 python,就会发生这种情况。ansible documentation建议手动为每个主机执行此操作:ansible myhost --sudo -m raw -a "yum install -y python2 python-simplejson"

但是我认为最好在剧本开头使用此代码片段引导所有主机:


- name: Bootrstrap python
hosts: localhost
tasks:
raw: sudo apt-get update && sudo apt-get -y python-simplejson
delegate_to: '{{ item }}'
with_items: {{ groups["hosts"] }}

关于python - 安塞 bool + 10.11.6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38799807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com