[英]Ansible Venv Activate Permission Denied Django CMS
我在安裝干凈的Django CMS實例時扮演一個角色,嘗試激活安裝的Virtual Env時遇到權限錯誤,我讀到有時這可能是由於使用不同的權限創建環境而導致的並激活它。 我在兩種情況下都嘗試過使用root sudo和不使用root sudo。
我正在使用Ubuntu/Trusty64
盒。
這是我從任務中得到的錯誤:
TASK [dependancies : Activate Venv] ******************************************** fatal: [default]: FAILED! => {"changed": false, "cmd": ". env/bin/activate", "failed": true, "msg": "[Errno 13] Permission denied", "rc": 13}
這是我的角色文件:
---
- name: Update apt-get
become: yes
apt:
update_cache: yes
- name: Install Packages
apt:
name: "{{ item }}"
with_items:
- nginx
- python3
- python-pip
- nodejs
- git
- python-passlib # for htpasswd
- postgresql
- libpq-dev # for postgresql
- python-psycopg2 # for postgresql
- ansible # to run ansible-pull
become: yes
- name: Install Python Libraries
pip:
name: "{{ item }}"
executable: pip
become: yes
with_items:
- virtualenv
- awscli # for backups
- name: Create Venv
command: virtualenv env
args:
creates: env/bin/activate
- name: Activate Venv
command: . env/bin/activate
- name: Install Django-CMS Insaller
pip:
name: djangocms-installer
executable: pip
- name: Create Folder
file: path=django state=directory
- name: Create Django CMS
command: djangocms -s -p . testSite
args:
chdir: django
become: yes
任何建議將不勝感激。
首先,您不應該這樣做!
將pip
軟件包與virtualenv
參數一起使用。 如果仍然要激活。 請參閱此SO問題中的示例。
如果仍然要在外殼程序內部激活虛擬環境,則應使用shell
模塊(不是command
!)使source bin/activate
起作用。 source
和.
是bash內置程序,因此command
模塊無法執行它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.