【发布时间】:2013-12-13 20:08:09
【问题描述】:
有没有更好的方法在远程机器上的 virtualenv 中运行 ansible?
到目前为止,我可以看到的方式是手动修改 .bashrc 文件或使用 ansible 本身。
例如:
tasks:
- name: "Enable virtualenv in .bashrc"
lineinfile: dest=.bashrc
line="source {{ PROJECT_HOME }}/venv/bin/activate"
#
# Put tasks that rely on this precondition here (?)
#
# Optionally, disable this later on
- name: "Disable virtualenv in .bashrc"
lineinfile: dest=.bashrc
line="source {{ PROJECT_HOME }}/venv/bin/activate"
state=absent
TODO:检查是否可以使用 ssh 授权密钥完成:http://binblog.info/2008/10/20/openssh-going-flexible-with-forced-commands/
【问题讨论】:
标签: ansible