質問編集履歴
5
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -159,7 +159,7 @@
|
|
159
159
|
|
160
160
|
|
161
161
|
|
162
|
-
|
162
|
+
```エラー
|
163
163
|
PLAY [Deploy mezzanine] ********************************************************
|
164
164
|
|
165
165
|
TASK [setup] *******************************************************************
|
4
えらー
title
CHANGED
File without changes
|
body
CHANGED
@@ -154,4 +154,52 @@
|
|
154
154
|
sudo: True
|
155
155
|
|
156
156
|
|
157
|
+
```
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
エラー全体```ここに言語を入力
|
163
|
+
PLAY [Deploy mezzanine] ********************************************************
|
164
|
+
|
165
|
+
TASK [setup] *******************************************************************
|
166
|
+
ok: [web]
|
167
|
+
|
168
|
+
TASK [install apt packages] ****************************************************
|
169
|
+
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'])
|
170
|
+
|
171
|
+
TASK [check out the repository on the host] ************************************
|
172
|
+
ok: [web]
|
173
|
+
|
174
|
+
TASK [install required python packages] ****************************************
|
175
|
+
ok: [web] => (item=gunicorn)
|
176
|
+
ok: [web] => (item=setproctitle)
|
177
|
+
ok: [web] => (item=south)
|
178
|
+
ok: [web] => (item=psycopg2)
|
179
|
+
ok: [web] => (item=django-compressor)
|
180
|
+
ok: [web] => (item=python-memcached)
|
181
|
+
|
182
|
+
TASK [install requirements.txt] ************************************************
|
183
|
+
ok: [web]
|
184
|
+
|
185
|
+
TASK [create a user] ***********************************************************
|
186
|
+
ok: [web]
|
187
|
+
|
188
|
+
TASK [create the database] *****************************************************
|
189
|
+
ok: [web]
|
190
|
+
|
191
|
+
TASK [generate the settings file] **********************************************
|
192
|
+
ok: [web]
|
193
|
+
|
194
|
+
TASK [sync the database, apply migrations, collect static content] *************
|
195
|
+
failed: [web] (item=syncdb) => {"cmd": "./manage.py syncdb --noinput", "failed": true, "item": "syncdb", "msg": "[Errno 13] Permission denied", "rc": 13}
|
196
|
+
failed: [web] (item=migrate) => {"cmd": "./manage.py migrate --noinput", "failed": true, "item": "migrate", "msg": "[Errno 13] Permission denied", "rc": 13}
|
197
|
+
failed: [web] (item=collectstatic) => {"cmd": "./manage.py collectstatic --noinput", "failed": true, "item": "collectstatic", "msg": "[Errno 13] Permission denied", "rc": 13}
|
198
|
+
|
199
|
+
NO MORE HOSTS LEFT *************************************************************
|
200
|
+
[WARNING]: Could not create retry file 'mezzanine.retry'. [Errno 2] No such file or directory: ''
|
201
|
+
|
202
|
+
|
203
|
+
PLAY RECAP *********************************************************************
|
204
|
+
web : ok=8 changed=0 unreachable=0 failed=1
|
157
205
|
```
|
3
playbook
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,4 +4,154 @@
|
|
4
4
|
TASK [sync the database, apply migrations, collect static content] *************
|
5
5
|
failed: [web] (item=syncdb) => {"cmd": "./manage.py syncdb --noinput", "failed": true, "item": "syncdb", "msg": "[Errno 13] Permission denied", "rc": 13}
|
6
6
|
failed: [web] (item=migrate) => {"cmd": "./manage.py migrate --noinput", "failed": true, "item": "migrate", "msg": "[Errno 13] Permission denied", "rc": 13}
|
7
|
-
failed: [web] (item=collectstatic) => {"cmd": "./manage.py collectstatic --noinput", "failed": true, "item": "collectstatic", "msg": "[Errno 13] Permission denied", "rc": 13}
|
7
|
+
failed: [web] (item=collectstatic) => {"cmd": "./manage.py collectstatic --noinput", "failed": true, "item": "collectstatic", "msg": "[Errno 13] Permission denied", "rc": 13}
|
8
|
+
|
9
|
+
|
10
|
+
```playbook
|
11
|
+
---
|
12
|
+
- name: Deploy mezzanine
|
13
|
+
hosts: web
|
14
|
+
vars:
|
15
|
+
user: "{{ ansible_ssh_user }}"
|
16
|
+
proj_name: mezzanine-example
|
17
|
+
venv_home: "{{ ansible_env.HOME }}"
|
18
|
+
venv_path: "{{ venv_home }}/{{ proj_name }}"
|
19
|
+
proj_dirname: project
|
20
|
+
proj_path: "{{ venv_path }}/{{ proj_dirname }}"
|
21
|
+
reqs_path: requirements.txt
|
22
|
+
manage: "{{ python }} {{ proj_path }}/manage.py"
|
23
|
+
live_hostname: 192.168.33.10.xip.io
|
24
|
+
domains:
|
25
|
+
- 192.168.33.10.xip.io
|
26
|
+
- www.192.168.33.10.xip.io
|
27
|
+
repo_url: git@github.com:lorin/mezzanine-example.git
|
28
|
+
gunicorn_port: 8000
|
29
|
+
locale: en_US.UTF-8
|
30
|
+
# Variables below don't appear in Mezannine's fabfile.py
|
31
|
+
# but I've added them for convenience
|
32
|
+
conf_path: /etc/nginx/conf
|
33
|
+
tls_enabled: True
|
34
|
+
python: "{{ venv_path }}/bin/python"
|
35
|
+
database_name: "{{ proj_name }}"
|
36
|
+
database_user: "{{ proj_name }}"
|
37
|
+
database_host: localhost
|
38
|
+
database_port: 5432
|
39
|
+
gunicorn_proc_name: mezzanine
|
40
|
+
vars_files:
|
41
|
+
- secrets.yml
|
42
|
+
tasks:
|
43
|
+
- name: install apt packages
|
44
|
+
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600
|
45
|
+
sudo: True
|
46
|
+
with_items:
|
47
|
+
- git
|
48
|
+
- libjpeg-dev
|
49
|
+
- libpq-dev
|
50
|
+
- memcached
|
51
|
+
- nginx
|
52
|
+
- postgresql
|
53
|
+
- python-dev
|
54
|
+
- python-pip
|
55
|
+
- python-psycopg2
|
56
|
+
- python-setuptools
|
57
|
+
- python-virtualenv
|
58
|
+
- supervisor
|
59
|
+
- name: check out the repository on the host
|
60
|
+
git: repo={{ repo_url }} dest={{ proj_path }} accept_hostkey=yes update=yes
|
61
|
+
- name: install required python packages
|
62
|
+
pip: name={{ item }} virtualenv={{ venv_path }}
|
63
|
+
with_items:
|
64
|
+
- gunicorn
|
65
|
+
- setproctitle
|
66
|
+
- south
|
67
|
+
- psycopg2
|
68
|
+
- django-compressor
|
69
|
+
- python-memcached
|
70
|
+
- name: install requirements.txt
|
71
|
+
pip: requirements={{ proj_path }}/{{ reqs_path }} virtualenv={{ venv_path }}
|
72
|
+
- name: create a user
|
73
|
+
postgresql_user:
|
74
|
+
name: "{{ database_user }}"
|
75
|
+
password: "{{ db_pass }}"
|
76
|
+
sudo: True
|
77
|
+
sudo_user: postgres
|
78
|
+
- name: create the database
|
79
|
+
postgresql_db:
|
80
|
+
name: "{{ database_name }}"
|
81
|
+
owner: "{{ database_user }}"
|
82
|
+
encoding: UTF8
|
83
|
+
lc_ctype: "{{ locale }}"
|
84
|
+
lc_collate: "{{ locale }}"
|
85
|
+
template: template0
|
86
|
+
sudo: True
|
87
|
+
sudo_user: postgres
|
88
|
+
- name: generate the settings file
|
89
|
+
template: src=templates/local_settings.py.j2 dest={{ proj_path }}/local_settings.py
|
90
|
+
- name: sync the database, apply migrations, collect static content
|
91
|
+
django_manage:
|
92
|
+
command: "{{ item }}"
|
93
|
+
app_path: "{{ proj_path }}"
|
94
|
+
virtualenv: "{{ venv_path }}"
|
95
|
+
with_items:
|
96
|
+
- syncdb
|
97
|
+
- migrate
|
98
|
+
- collectstatic
|
99
|
+
- name: set the site id
|
100
|
+
script: scripts/setsite.py
|
101
|
+
environment:
|
102
|
+
PATH: "{{ venv_path }}/bin"
|
103
|
+
PROJECT_DIR: "{{ proj_path }}"
|
104
|
+
WEBSITE_DOMAIN: "{{ live_hostname }}"
|
105
|
+
- name: set the admin password
|
106
|
+
script: scripts/setadmin.py
|
107
|
+
environment:
|
108
|
+
PATH: "{{ venv_path }}/bin"
|
109
|
+
PROJECT_DIR: "{{ proj_path }}"
|
110
|
+
ADMIN_PASSWORD: "{{ admin_pass }}"
|
111
|
+
- name: set the gunicorn config file
|
112
|
+
template: src=templates/gunicorn.conf.py.j2 dest={{ proj_path }}/gunicorn.conf.py
|
113
|
+
- name: set the supervisor config file
|
114
|
+
template: src=templates/supervisor.conf.j2 dest=/etc/supervisor/conf.d/mezzanine.conf
|
115
|
+
sudo: True
|
116
|
+
notify: restart supervisor
|
117
|
+
- name: set the nginx config file
|
118
|
+
template: src=templates/nginx.conf.j2 dest=/etc/nginx/sites-available/mezzanine.conf
|
119
|
+
notify: restart nginx
|
120
|
+
sudo: True
|
121
|
+
- name: enable the nginx config file
|
122
|
+
file:
|
123
|
+
src: /etc/nginx/sites-available/mezzanine.conf
|
124
|
+
dest: /etc/nginx/sites-enabled/mezzanine.conf
|
125
|
+
state: link
|
126
|
+
notify: restart nginx
|
127
|
+
sudo: True
|
128
|
+
- name: remove the default nginx config file
|
129
|
+
file: path=/etc/nginx/sites-enabled/default state=absent
|
130
|
+
notify: restart nginx
|
131
|
+
sudo: True
|
132
|
+
- name: ensure config path exists
|
133
|
+
file: path={{ conf_path }} state=directory
|
134
|
+
sudo: True
|
135
|
+
when: tls_enabled
|
136
|
+
- name: create ssl certificates
|
137
|
+
command: >
|
138
|
+
openssl req -new -x509 -nodes -out {{ proj_name }}.crt
|
139
|
+
-keyout {{ proj_name }}.key -subj '/CN={{ domains[0] }}' -days 3650
|
140
|
+
chdir={{ conf_path }}
|
141
|
+
creates={{ conf_path }}/{{ proj_name }}.crt
|
142
|
+
sudo: True
|
143
|
+
when: tls_enabled
|
144
|
+
notify: restart nginx
|
145
|
+
- name: install poll twitter cron job
|
146
|
+
cron: name="poll twitter" minute="*/5" user={{ user }} job="{{ manage }} poll_twitter"
|
147
|
+
|
148
|
+
handlers:
|
149
|
+
- name: restart supervisor
|
150
|
+
supervisorctl: name=gunicorn_mezzanine state=restarted
|
151
|
+
sudo: True
|
152
|
+
- name: restart nginx
|
153
|
+
service: name=nginx state=restarted
|
154
|
+
sudo: True
|
155
|
+
|
156
|
+
|
157
|
+
```
|
2
題名変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
初めてのAnsibleの6章のplaybookについて2
|
body
CHANGED
File without changes
|
1
タグを足しました
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
初めてのAnsibleの6章のplaybookについて2
|
1
|
+
py初めてのAnsibleの6章のplaybookについて2
|
body
CHANGED
File without changes
|