Pip 使用ansible playbook安装Lopstio 0.14

Pip 使用ansible playbook安装Lopstio 0.14,pip,ansible,locust,Pip,Ansible,Locust,我是ansible的新手,正在编写一本剧本,在Ubuntu18.04上安装带有python3的locustio。我不知道如何在playbook中安装带有pip3的locustio。如果使用pip包,那么使用旧版本的蝗虫会产生错误。(使用固定的旧蝗虫版本(pip/pip3安装locustio==0.13.5)。我想知道如何使用pip3安装蝗虫或使用pip安装locust 0.13.5版本 我还没有使用Ansible,但看看这里似乎有一个可执行文件,您可以将其设置为pip3您看到pip Ansib

我是ansible的新手,正在编写一本剧本,在Ubuntu18.04上安装带有python3的locustio。我不知道如何在playbook中安装带有pip3的locustio。如果使用pip包,那么使用旧版本的蝗虫会产生错误。(使用固定的旧蝗虫版本(pip/pip3安装locustio==0.13.5)。我想知道如何使用pip3安装蝗虫或使用pip安装locust 0.13.5版本



我还没有使用Ansible,但看看这里似乎有一个
可执行文件
,您可以将其设置为
pip3

您看到pip Ansible模块文档了吗?您可以指定pip版本以及库版本。(超出范围,但是良好的做法):您可以将所有
apt
操作合并到一个任务=>
名称:['pyhton3','python3 pip','python pip']
。如果您的所有游戏都需要升级权限,请在游戏级别将
设置为:true
,而不是在每个任务中重复。
- hosts: all
  tasks:
   - name: Create folder to keep the files
     file:
             path: /opt/locust
             state: directory
             mode: '0755'
     become: yes

   - name: Python installation
     apt:
             name: ['python3']
             state: present
     become: yes

   - name: Pip installation
     apt:
             name: ['python3-pip']
             state: present
     become: yes

   - name: pip install
     apt:
             name: ['python-pip']
             state: present
     become: yes

   - name: Locust Installation
     pip:
             name: ['locustio']
             state: present
     become: yes