我收到此错误:
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."}
根据建议,我运行以下命令:
ansible default -a "which pip"
我收到一个错误:
default | FAILED | rc=1 >>
non-zero return code
所以我想这意味着没有安装 pip。我尝试使用以下方法安装 pip:
ansible default -a "easy_install pip"
我收到以下错误:
default | FAILED | rc=2 >>
[Errno 2] No such file or directory
有任何想法吗?
更新
在 play_local.yaml 中,我有以下任务:
- 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吗?
最佳答案
好像没有安装pip,可以使用下面的任务来安装:
- name: Install pip
apt:
name: python-pip
update_cache: yes
state: present
关于Ansible - 找不到 pip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51997637/