質問編集履歴
5
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -320,7 +320,7 @@
|
|
320
320
|
|
321
321
|
|
322
322
|
|
323
|
-
エラー
|
323
|
+
```エラー
|
324
324
|
|
325
325
|
PLAY [Deploy mezzanine] ********************************************************
|
326
326
|
|
4
えらー
test
CHANGED
File without changes
|
test
CHANGED
@@ -311,3 +311,99 @@
|
|
311
311
|
|
312
312
|
|
313
313
|
```
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
エラー全体```ここに言語を入力
|
324
|
+
|
325
|
+
PLAY [Deploy mezzanine] ********************************************************
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
TASK [setup] *******************************************************************
|
330
|
+
|
331
|
+
ok: [web]
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
TASK [install apt packages] ****************************************************
|
336
|
+
|
337
|
+
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'])
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
TASK [check out the repository on the host] ************************************
|
342
|
+
|
343
|
+
ok: [web]
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
TASK [install required python packages] ****************************************
|
348
|
+
|
349
|
+
ok: [web] => (item=gunicorn)
|
350
|
+
|
351
|
+
ok: [web] => (item=setproctitle)
|
352
|
+
|
353
|
+
ok: [web] => (item=south)
|
354
|
+
|
355
|
+
ok: [web] => (item=psycopg2)
|
356
|
+
|
357
|
+
ok: [web] => (item=django-compressor)
|
358
|
+
|
359
|
+
ok: [web] => (item=python-memcached)
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
TASK [install requirements.txt] ************************************************
|
364
|
+
|
365
|
+
ok: [web]
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
TASK [create a user] ***********************************************************
|
370
|
+
|
371
|
+
ok: [web]
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
TASK [create the database] *****************************************************
|
376
|
+
|
377
|
+
ok: [web]
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
TASK [generate the settings file] **********************************************
|
382
|
+
|
383
|
+
ok: [web]
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
TASK [sync the database, apply migrations, collect static content] *************
|
388
|
+
|
389
|
+
failed: [web] (item=syncdb) => {"cmd": "./manage.py syncdb --noinput", "failed": true, "item": "syncdb", "msg": "[Errno 13] Permission denied", "rc": 13}
|
390
|
+
|
391
|
+
failed: [web] (item=migrate) => {"cmd": "./manage.py migrate --noinput", "failed": true, "item": "migrate", "msg": "[Errno 13] Permission denied", "rc": 13}
|
392
|
+
|
393
|
+
failed: [web] (item=collectstatic) => {"cmd": "./manage.py collectstatic --noinput", "failed": true, "item": "collectstatic", "msg": "[Errno 13] Permission denied", "rc": 13}
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
NO MORE HOSTS LEFT *************************************************************
|
398
|
+
|
399
|
+
[WARNING]: Could not create retry file 'mezzanine.retry'. [Errno 2] No such file or directory: ''
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
PLAY RECAP *********************************************************************
|
406
|
+
|
407
|
+
web : ok=8 changed=0 unreachable=0 failed=1
|
408
|
+
|
409
|
+
```
|
3
playbook
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,3 +11,303 @@
|
|
11
11
|
failed: [web] (item=migrate) => {"cmd": "./manage.py migrate --noinput", "failed": true, "item": "migrate", "msg": "[Errno 13] Permission denied", "rc": 13}
|
12
12
|
|
13
13
|
failed: [web] (item=collectstatic) => {"cmd": "./manage.py collectstatic --noinput", "failed": true, "item": "collectstatic", "msg": "[Errno 13] Permission denied", "rc": 13}
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
```playbook
|
20
|
+
|
21
|
+
---
|
22
|
+
|
23
|
+
- name: Deploy mezzanine
|
24
|
+
|
25
|
+
hosts: web
|
26
|
+
|
27
|
+
vars:
|
28
|
+
|
29
|
+
user: "{{ ansible_ssh_user }}"
|
30
|
+
|
31
|
+
proj_name: mezzanine-example
|
32
|
+
|
33
|
+
venv_home: "{{ ansible_env.HOME }}"
|
34
|
+
|
35
|
+
venv_path: "{{ venv_home }}/{{ proj_name }}"
|
36
|
+
|
37
|
+
proj_dirname: project
|
38
|
+
|
39
|
+
proj_path: "{{ venv_path }}/{{ proj_dirname }}"
|
40
|
+
|
41
|
+
reqs_path: requirements.txt
|
42
|
+
|
43
|
+
manage: "{{ python }} {{ proj_path }}/manage.py"
|
44
|
+
|
45
|
+
live_hostname: 192.168.33.10.xip.io
|
46
|
+
|
47
|
+
domains:
|
48
|
+
|
49
|
+
- 192.168.33.10.xip.io
|
50
|
+
|
51
|
+
- www.192.168.33.10.xip.io
|
52
|
+
|
53
|
+
repo_url: git@github.com:lorin/mezzanine-example.git
|
54
|
+
|
55
|
+
gunicorn_port: 8000
|
56
|
+
|
57
|
+
locale: en_US.UTF-8
|
58
|
+
|
59
|
+
# Variables below don't appear in Mezannine's fabfile.py
|
60
|
+
|
61
|
+
# but I've added them for convenience
|
62
|
+
|
63
|
+
conf_path: /etc/nginx/conf
|
64
|
+
|
65
|
+
tls_enabled: True
|
66
|
+
|
67
|
+
python: "{{ venv_path }}/bin/python"
|
68
|
+
|
69
|
+
database_name: "{{ proj_name }}"
|
70
|
+
|
71
|
+
database_user: "{{ proj_name }}"
|
72
|
+
|
73
|
+
database_host: localhost
|
74
|
+
|
75
|
+
database_port: 5432
|
76
|
+
|
77
|
+
gunicorn_proc_name: mezzanine
|
78
|
+
|
79
|
+
vars_files:
|
80
|
+
|
81
|
+
- secrets.yml
|
82
|
+
|
83
|
+
tasks:
|
84
|
+
|
85
|
+
- name: install apt packages
|
86
|
+
|
87
|
+
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600
|
88
|
+
|
89
|
+
sudo: True
|
90
|
+
|
91
|
+
with_items:
|
92
|
+
|
93
|
+
- git
|
94
|
+
|
95
|
+
- libjpeg-dev
|
96
|
+
|
97
|
+
- libpq-dev
|
98
|
+
|
99
|
+
- memcached
|
100
|
+
|
101
|
+
- nginx
|
102
|
+
|
103
|
+
- postgresql
|
104
|
+
|
105
|
+
- python-dev
|
106
|
+
|
107
|
+
- python-pip
|
108
|
+
|
109
|
+
- python-psycopg2
|
110
|
+
|
111
|
+
- python-setuptools
|
112
|
+
|
113
|
+
- python-virtualenv
|
114
|
+
|
115
|
+
- supervisor
|
116
|
+
|
117
|
+
- name: check out the repository on the host
|
118
|
+
|
119
|
+
git: repo={{ repo_url }} dest={{ proj_path }} accept_hostkey=yes update=yes
|
120
|
+
|
121
|
+
- name: install required python packages
|
122
|
+
|
123
|
+
pip: name={{ item }} virtualenv={{ venv_path }}
|
124
|
+
|
125
|
+
with_items:
|
126
|
+
|
127
|
+
- gunicorn
|
128
|
+
|
129
|
+
- setproctitle
|
130
|
+
|
131
|
+
- south
|
132
|
+
|
133
|
+
- psycopg2
|
134
|
+
|
135
|
+
- django-compressor
|
136
|
+
|
137
|
+
- python-memcached
|
138
|
+
|
139
|
+
- name: install requirements.txt
|
140
|
+
|
141
|
+
pip: requirements={{ proj_path }}/{{ reqs_path }} virtualenv={{ venv_path }}
|
142
|
+
|
143
|
+
- name: create a user
|
144
|
+
|
145
|
+
postgresql_user:
|
146
|
+
|
147
|
+
name: "{{ database_user }}"
|
148
|
+
|
149
|
+
password: "{{ db_pass }}"
|
150
|
+
|
151
|
+
sudo: True
|
152
|
+
|
153
|
+
sudo_user: postgres
|
154
|
+
|
155
|
+
- name: create the database
|
156
|
+
|
157
|
+
postgresql_db:
|
158
|
+
|
159
|
+
name: "{{ database_name }}"
|
160
|
+
|
161
|
+
owner: "{{ database_user }}"
|
162
|
+
|
163
|
+
encoding: UTF8
|
164
|
+
|
165
|
+
lc_ctype: "{{ locale }}"
|
166
|
+
|
167
|
+
lc_collate: "{{ locale }}"
|
168
|
+
|
169
|
+
template: template0
|
170
|
+
|
171
|
+
sudo: True
|
172
|
+
|
173
|
+
sudo_user: postgres
|
174
|
+
|
175
|
+
- name: generate the settings file
|
176
|
+
|
177
|
+
template: src=templates/local_settings.py.j2 dest={{ proj_path }}/local_settings.py
|
178
|
+
|
179
|
+
- name: sync the database, apply migrations, collect static content
|
180
|
+
|
181
|
+
django_manage:
|
182
|
+
|
183
|
+
command: "{{ item }}"
|
184
|
+
|
185
|
+
app_path: "{{ proj_path }}"
|
186
|
+
|
187
|
+
virtualenv: "{{ venv_path }}"
|
188
|
+
|
189
|
+
with_items:
|
190
|
+
|
191
|
+
- syncdb
|
192
|
+
|
193
|
+
- migrate
|
194
|
+
|
195
|
+
- collectstatic
|
196
|
+
|
197
|
+
- name: set the site id
|
198
|
+
|
199
|
+
script: scripts/setsite.py
|
200
|
+
|
201
|
+
environment:
|
202
|
+
|
203
|
+
PATH: "{{ venv_path }}/bin"
|
204
|
+
|
205
|
+
PROJECT_DIR: "{{ proj_path }}"
|
206
|
+
|
207
|
+
WEBSITE_DOMAIN: "{{ live_hostname }}"
|
208
|
+
|
209
|
+
- name: set the admin password
|
210
|
+
|
211
|
+
script: scripts/setadmin.py
|
212
|
+
|
213
|
+
environment:
|
214
|
+
|
215
|
+
PATH: "{{ venv_path }}/bin"
|
216
|
+
|
217
|
+
PROJECT_DIR: "{{ proj_path }}"
|
218
|
+
|
219
|
+
ADMIN_PASSWORD: "{{ admin_pass }}"
|
220
|
+
|
221
|
+
- name: set the gunicorn config file
|
222
|
+
|
223
|
+
template: src=templates/gunicorn.conf.py.j2 dest={{ proj_path }}/gunicorn.conf.py
|
224
|
+
|
225
|
+
- name: set the supervisor config file
|
226
|
+
|
227
|
+
template: src=templates/supervisor.conf.j2 dest=/etc/supervisor/conf.d/mezzanine.conf
|
228
|
+
|
229
|
+
sudo: True
|
230
|
+
|
231
|
+
notify: restart supervisor
|
232
|
+
|
233
|
+
- name: set the nginx config file
|
234
|
+
|
235
|
+
template: src=templates/nginx.conf.j2 dest=/etc/nginx/sites-available/mezzanine.conf
|
236
|
+
|
237
|
+
notify: restart nginx
|
238
|
+
|
239
|
+
sudo: True
|
240
|
+
|
241
|
+
- name: enable the nginx config file
|
242
|
+
|
243
|
+
file:
|
244
|
+
|
245
|
+
src: /etc/nginx/sites-available/mezzanine.conf
|
246
|
+
|
247
|
+
dest: /etc/nginx/sites-enabled/mezzanine.conf
|
248
|
+
|
249
|
+
state: link
|
250
|
+
|
251
|
+
notify: restart nginx
|
252
|
+
|
253
|
+
sudo: True
|
254
|
+
|
255
|
+
- name: remove the default nginx config file
|
256
|
+
|
257
|
+
file: path=/etc/nginx/sites-enabled/default state=absent
|
258
|
+
|
259
|
+
notify: restart nginx
|
260
|
+
|
261
|
+
sudo: True
|
262
|
+
|
263
|
+
- name: ensure config path exists
|
264
|
+
|
265
|
+
file: path={{ conf_path }} state=directory
|
266
|
+
|
267
|
+
sudo: True
|
268
|
+
|
269
|
+
when: tls_enabled
|
270
|
+
|
271
|
+
- name: create ssl certificates
|
272
|
+
|
273
|
+
command: >
|
274
|
+
|
275
|
+
openssl req -new -x509 -nodes -out {{ proj_name }}.crt
|
276
|
+
|
277
|
+
-keyout {{ proj_name }}.key -subj '/CN={{ domains[0] }}' -days 3650
|
278
|
+
|
279
|
+
chdir={{ conf_path }}
|
280
|
+
|
281
|
+
creates={{ conf_path }}/{{ proj_name }}.crt
|
282
|
+
|
283
|
+
sudo: True
|
284
|
+
|
285
|
+
when: tls_enabled
|
286
|
+
|
287
|
+
notify: restart nginx
|
288
|
+
|
289
|
+
- name: install poll twitter cron job
|
290
|
+
|
291
|
+
cron: name="poll twitter" minute="*/5" user={{ user }} job="{{ manage }} poll_twitter"
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
handlers:
|
296
|
+
|
297
|
+
- name: restart supervisor
|
298
|
+
|
299
|
+
supervisorctl: name=gunicorn_mezzanine state=restarted
|
300
|
+
|
301
|
+
sudo: True
|
302
|
+
|
303
|
+
- name: restart nginx
|
304
|
+
|
305
|
+
service: name=nginx state=restarted
|
306
|
+
|
307
|
+
sudo: True
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
```
|
2
題名変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
初めてのAnsibleの6章のplaybookについて2
|
test
CHANGED
File without changes
|
1
タグを足しました
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
初めてのAnsibleの6章のplaybookについて2
|
1
|
+
py初めてのAnsibleの6章のplaybookについて2
|
test
CHANGED
File without changes
|