2017-11-26 2 views
-2

Ich versuche, meine Django auf AWS Ubuntu-Maschine mit Ansible bereitstellen. Allerdings bekomme ich diese Erlaubnis auf meinen Paketen verweigert. Wie kann ich das lösen? Vielen Dank. HierAnsible Django Deploy-Berechtigung verweigert Pip-Pakete

ist der Fehler:

$ ./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' 

Im Folgenden sind einige der anderen erhältlichen Code:

Anforderungen/production.txt

https://gist.github.com/anonymous/79f4d0b43f39fc317d33e09dbd1c58ba

deploy.yaml

https://gist.github.com/anonymous/02f68f05dab3f6858ab6aa10c89f5e09

Ubuntu: 14,04

Ich überprüfe die Benutzergruppe Ich verwende die ubuntu zugreifen und es sudo in der Gruppe hat. Müssen wir als root laufen?

$ groups deployuser 
deployuser : deployuser sudo 

Basis ich meine ansible aus dieser Anleitung:

https://baxeico.wordpress.com/2017/05/02/how-to-deploy-a-django-project-in-15-minutes-with-ansible/

Antwort

0

sudo In Abschnitt pip installieren:

- hosts: all 
    become: yes # <- here 
    gather_facts: no 
    tasks: 
    - name: install python requirements 
    pip: requirements={{ repo_dir }}/requirements/production.txt extra_args=--upgrade 
+0

, die funktioniert! aber sudo fragt tatsächlich nach dem passwort, also habe ich es gelöst, indem ich --ask-sudo-pass an der cmd-zeile habe – Axil

Verwandte Themen