Ansible-未找到点子 [英] Ansible - pip not found

查看:212
本文介绍了Ansible-未找到点子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误:

    TASK [pip] *********************************************************************
    failed: [default] (item=urllib3) => 
{"changed": false, "item": "urllib3", 
"msg": "Unable to find any of pip2, pip to use.  pip needs to be installed."}

根据建议,我运行以下命令:

Upon a suggestion I run following command:

ansible default -a "which pip"

我得到一个错误:

default | FAILED | rc=1 >>
non-zero return code

所以我想这意味着没有安装任何点子.我尝试使用以下方法安装pip:

So I guess that means no pip installed. I tried installing pip using:

ansible default -a "easy_install pip"

我收到以下错误:

default | FAILED | rc=2 >>
[Errno 2] No such file or directory

有什么想法吗?

更新 在play_local.yaml中,我有以下任务:

UPDATE In play_local.yaml, I have the following task:

- name: Prepare system
  hosts: default
  become: yes
  gather_facts: false
  pre_tasks:
    - raw: sudo apt-get -y install python python-setuptools python-pip build-essential libssl-dev libffi-dev python-dev easyinstall pip
    - file: path=/etc/sudoers.d/ssh-auth-sock state=touch mode=0440
      #- lineinfile: line='Defaults env_keep += "SSH_AUTH_SOCK"' path=/etc/sudoers.d/ssh-auth-sock
    - replace:
        path: /etc/apt/sources.list
        regexp: 'br.'
        replace: ''

此任务不应该安装pip吗?

Shouldn't this task install pip?

推荐答案

可能对pip进行了哈希处理.意思是pip安装在路径x(可能是/usr/local/bin/pip),但是缓存在路径y(可能是/usr/bin/pip).您可以从-ansible default -m shell -a ‘type pip’确认.要解决此问题,您需要运行-.

May be pip is hashed. Meaning pip is installed at path x (may be /usr/local/bin/pip), however, cached at path y (may be /usr/bin/pip). You can confirm that from - ansible default -m shell -a ‘type pip’. To resolve this you’ll need to run - ansible default -m shell -a ‘hash -r’.

顺便说一句,您也可以使用命令模块代替shell.

BTW, you can also use command module instead of shell.

这篇关于Ansible-未找到点子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆