我正在尝试使用ansible将我的django部署到aws ubuntu机器上。但是,我一直在我的包裹上拒绝此权限。我怎么解决这个问题?感谢。
这是错误:
$ ./ansible.sh deploy.yaml
.....
Downloading from URL https://pypi.python.org/packages/a6/1c/72a18c8c7502ee1b38a604a5c5243aa8c2a64f4bba4e6631b1b8972235dd/futures-3.1.1-py2-none-any.whl#md5=61a88f749eb3655042f95d198f783ef3 (from https://pypi.python.org/simple/futures/)
Installing collected packages: boto3, botocore, certifi, cffi, chardet, coreapi, coreschema, cryptography, Django, django-bootstrap3, django-countries, django-datatable, django-rest-swagger, django-storages, djangorestframework, docutils, gunicorn, idna, itypes, Jinja2, jmespath, MarkupSafe, olefile, openapi-codec, paramiko, Pillow, psycopg2, pyasn1, pycparser, PyNaCl, python-dateutil, python-decouple, pytz, PyYAML, requests, s3transfer, simplejson, six, sorl-thumbnail, uritemplate, urllib3, dj-database-url, asn1crypto, bcrypt, futures
Cleaning up...
Removing temporary dir /tmp/pip_build_deploy...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
pycompile=self.pycompile,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber
os.makedirs(destsubdir)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/boto3-1.4.7.dist-info'
以下是其他一些相关代码:
要求/ production.txt
https://gist.github.com/anonymous/79f4d0b43f39fc317d33e09dbd1c58ba
deploy.yaml
https://gist.github.com/anonymous/02f68f05dab3f6858ab6aa10c89f5e09
Ubuntu:14.04
我检查用于访问ubuntu的用户组,并在组中有sudo。我们需要以root身份运行吗?
$ groups deployuser
deployuser : deployuser sudo
我根据这些指示建立了我的安慰:
https://baxeico.wordpress.com/2017/05/02/how-to-deploy-a-django-project-in-15-minutes-with-ansible/
答案 0 :(得分:0)
将sudo
添加到pip install部分:
- hosts: all
become: yes # <- here
gather_facts: no
tasks:
- name: install python requirements
pip: requirements={{ repo_dir }}/requirements/production.txt extra_args=--upgrade