初めてのAnsibleをやっているのですが、6章でエラーが出てわからないので教えて下さい。
TASK [sync the database, apply migrations, collect static content] *************
failed: [web] (item=syncdb) => {"cmd": "./manage.py syncdb --noinput", "failed": true, "item": "syncdb", "msg": "[Errno 13] Permission denied", "rc": 13}
failed: [web] (item=migrate) => {"cmd": "./manage.py migrate --noinput", "failed": true, "item": "migrate", "msg": "[Errno 13] Permission denied", "rc": 13}
failed: [web] (item=collectstatic) => {"cmd": "./manage.py collectstatic --noinput", "failed": true, "item": "collectstatic", "msg": "[Errno 13] Permission denied", "rc": 13}
playbook
1--- 2- name: Deploy mezzanine 3 hosts: web 4 vars: 5 user: "{{ ansible_ssh_user }}" 6 proj_name: mezzanine-example 7 venv_home: "{{ ansible_env.HOME }}" 8 venv_path: "{{ venv_home }}/{{ proj_name }}" 9 proj_dirname: project 10 proj_path: "{{ venv_path }}/{{ proj_dirname }}" 11 reqs_path: requirements.txt 12 manage: "{{ python }} {{ proj_path }}/manage.py" 13 live_hostname: 192.168.33.10.xip.io 14 domains: 15 - 192.168.33.10.xip.io 16 - www.192.168.33.10.xip.io 17 repo_url: git@github.com:lorin/mezzanine-example.git 18 gunicorn_port: 8000 19 locale: en_US.UTF-8 20 # Variables below don't appear in Mezannine's fabfile.py 21 # but I've added them for convenience 22 conf_path: /etc/nginx/conf 23 tls_enabled: True 24 python: "{{ venv_path }}/bin/python" 25 database_name: "{{ proj_name }}" 26 database_user: "{{ proj_name }}" 27 database_host: localhost 28 database_port: 5432 29 gunicorn_proc_name: mezzanine 30 vars_files: 31 - secrets.yml 32 tasks: 33 - name: install apt packages 34 apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 35 sudo: True 36 with_items: 37 - git 38 - libjpeg-dev 39 - libpq-dev 40 - memcached 41 - nginx 42 - postgresql 43 - python-dev 44 - python-pip 45 - python-psycopg2 46 - python-setuptools 47 - python-virtualenv 48 - supervisor 49 - name: check out the repository on the host 50 git: repo={{ repo_url }} dest={{ proj_path }} accept_hostkey=yes update=yes 51 - name: install required python packages 52 pip: name={{ item }} virtualenv={{ venv_path }} 53 with_items: 54 - gunicorn 55 - setproctitle 56 - south 57 - psycopg2 58 - django-compressor 59 - python-memcached 60 - name: install requirements.txt 61 pip: requirements={{ proj_path }}/{{ reqs_path }} virtualenv={{ venv_path }} 62 - name: create a user 63 postgresql_user: 64 name: "{{ database_user }}" 65 password: "{{ db_pass }}" 66 sudo: True 67 sudo_user: postgres 68 - name: create the database 69 postgresql_db: 70 name: "{{ database_name }}" 71 owner: "{{ database_user }}" 72 encoding: UTF8 73 lc_ctype: "{{ locale }}" 74 lc_collate: "{{ locale }}" 75 template: template0 76 sudo: True 77 sudo_user: postgres 78 - name: generate the settings file 79 template: src=templates/local_settings.py.j2 dest={{ proj_path }}/local_settings.py 80 - name: sync the database, apply migrations, collect static content 81 django_manage: 82 command: "{{ item }}" 83 app_path: "{{ proj_path }}" 84 virtualenv: "{{ venv_path }}" 85 with_items: 86 - syncdb 87 - migrate 88 - collectstatic 89 - name: set the site id 90 script: scripts/setsite.py 91 environment: 92 PATH: "{{ venv_path }}/bin" 93 PROJECT_DIR: "{{ proj_path }}" 94 WEBSITE_DOMAIN: "{{ live_hostname }}" 95 - name: set the admin password 96 script: scripts/setadmin.py 97 environment: 98 PATH: "{{ venv_path }}/bin" 99 PROJECT_DIR: "{{ proj_path }}" 100 ADMIN_PASSWORD: "{{ admin_pass }}" 101 - name: set the gunicorn config file 102 template: src=templates/gunicorn.conf.py.j2 dest={{ proj_path }}/gunicorn.conf.py 103 - name: set the supervisor config file 104 template: src=templates/supervisor.conf.j2 dest=/etc/supervisor/conf.d/mezzanine.conf 105 sudo: True 106 notify: restart supervisor 107 - name: set the nginx config file 108 template: src=templates/nginx.conf.j2 dest=/etc/nginx/sites-available/mezzanine.conf 109 notify: restart nginx 110 sudo: True 111 - name: enable the nginx config file 112 file: 113 src: /etc/nginx/sites-available/mezzanine.conf 114 dest: /etc/nginx/sites-enabled/mezzanine.conf 115 state: link 116 notify: restart nginx 117 sudo: True 118 - name: remove the default nginx config file 119 file: path=/etc/nginx/sites-enabled/default state=absent 120 notify: restart nginx 121 sudo: True 122 - name: ensure config path exists 123 file: path={{ conf_path }} state=directory 124 sudo: True 125 when: tls_enabled 126 - name: create ssl certificates 127 command: > 128 openssl req -new -x509 -nodes -out {{ proj_name }}.crt 129 -keyout {{ proj_name }}.key -subj '/CN={{ domains[0] }}' -days 3650 130 chdir={{ conf_path }} 131 creates={{ conf_path }}/{{ proj_name }}.crt 132 sudo: True 133 when: tls_enabled 134 notify: restart nginx 135 - name: install poll twitter cron job 136 cron: name="poll twitter" minute="*/5" user={{ user }} job="{{ manage }} poll_twitter" 137 138 handlers: 139 - name: restart supervisor 140 supervisorctl: name=gunicorn_mezzanine state=restarted 141 sudo: True 142 - name: restart nginx 143 service: name=nginx state=restarted 144 sudo: True 145 146
PLAY [Deploy mezzanine] ******************************************************** TASK [setup] ******************************************************************* ok: [web] TASK [install apt packages] **************************************************** ok: [web] => (item=[u'git', u'libjpeg-dev', u'libpq-dev', u'memcached', u'nginx', u'postgresql', u'python-dev', u'python-pip', u'python-psycopg2', u'python-setuptools', u'python-virtualenv', u'supervisor']) TASK [check out the repository on the host] ************************************ ok: [web] TASK [install required python packages] **************************************** ok: [web] => (item=gunicorn) ok: [web] => (item=setproctitle) ok: [web] => (item=south) ok: [web] => (item=psycopg2) ok: [web] => (item=django-compressor) ok: [web] => (item=python-memcached) TASK [install requirements.txt] ************************************************ ok: [web] TASK [create a user] *********************************************************** ok: [web] TASK [create the database] ***************************************************** ok: [web] TASK [generate the settings file] ********************************************** ok: [web] TASK [sync the database, apply migrations, collect static content] ************* failed: [web] (item=syncdb) => {"cmd": "./manage.py syncdb --noinput", "failed": true, "item": "syncdb", "msg": "[Errno 13] Permission denied", "rc": 13} failed: [web] (item=migrate) => {"cmd": "./manage.py migrate --noinput", "failed": true, "item": "migrate", "msg": "[Errno 13] Permission denied", "rc": 13} failed: [web] (item=collectstatic) => {"cmd": "./manage.py collectstatic --noinput", "failed": true, "item": "collectstatic", "msg": "[Errno 13] Permission denied", "rc": 13} NO MORE HOSTS LEFT ************************************************************* [WARNING]: Could not create retry file 'mezzanine.retry'. [Errno 2] No such file or directory: '' PLAY RECAP ********************************************************************* web : ok=8 changed=0 unreachable=0 failed=1
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/14 14:07
2016/08/14 14:11
2016/08/14 14:12