码迷,mamicode.com
首页 > 其他好文 > 详细

Ansible virtualenv下pip3安装requirements报错

时间:2020-05-25 19:14:17      阅读:58      评论:0      收藏:0      [点我收藏+]

标签:tps   env   path   round   out   parameter   start   xxxx   ted   

ansible step:

- name: Pip install reqs
  pip:
    requirements: /$HOME/requirements.txt
    virtualenv: {{ VENV }}
  become: true
  become_user: "{{ SERVICE_USER }}"
error:

TASK [xxxx : Check that the service has started] *********************************************************************************************
fatal: [xxxxx]: FAILED! => {"changed": true, "cmd": "pgrep python -u marin", "delta": "0:00:00.209812", "end": "2020-05-18 23:40:24.777255", "failed_when_result": true, "msg": "non-zero return code", "rc": 1, "start": "2020-05-18 23:40:24.567443", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

问题2:(由于安装的python3.6.4,想默认使用pip3.6安装requirements)

ansible step:

- name: Pip install reqs
  pip:
    requirements: /$HOME/requirements.txt
    virtualenv: {{ VENV }}
    executable: pip3.6
  become: true
  become_user: "{{ SERVICE_USER }}"
error

TASK [xxxx : Install required python modules] ************************************************************************************************
fatal: [fxxx]: FAILED! => {"changed": false, "msg": "parameters are mutually exclusive: executable|virtualenv"}

根据官方文档,错误是 executable无法和virtualenv 2个parameters并行
https://docs.ansible.com/ansible/latest/modules/pip_module.html

最终的workaround:
使用command在virtualenv path下直接运行pip3.6

- name: Install required python modules
  command: "{{ VENV }}/bin/pip3.6 install -r /home/marin/marin-insights-service/requirements.txt"
  become: true
  become_user: "{{ SERVICE_USER }}"

Ansible virtualenv下pip3安装requirements报错

标签:tps   env   path   round   out   parameter   start   xxxx   ted   

原文地址:https://www.cnblogs.com/toska/p/12959128.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!