Ansible command from inside virtualenv?

后端 未结 5 918
不知归路
不知归路 2021-01-30 08:49

This seems like it should be really simple:

tasks:
- name: install python packages
  pip: name=${item} virtualenv=~/buildbot-env
  with_items: [ buildbot ]
- nam         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 09:26

    The better way is to use the full path to installed script - it will run in its virtualenv automatically:

    tasks:
    - name: install python packages
      pip: name={{ item }} virtualenv={{ venv }}
      with_items: [ buildbot ]
    - name: create buildbot master
      command: "{{ venv }}/bin/buildbot create-master ~/buildbot
                creates=~/buildbot/buildbot.tac"
    

提交回复
热议问题