This repository has been archived by the owner on Jun 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnginx.yml
60 lines (49 loc) · 1.63 KB
/
nginx.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
- name: Set up nginx
hosts: vagrant
user: vagrant
tasks:
- name: Install nginx
apt: pkg=nginx state=present update_cache=yes
- name: Set up nginx config directory
file: path=/etc/nginx/{{ item }}
state=directory
with_items:
- sites-available
- sites-enabled
- name: Generate the nginx configuration file
copy: src=files/nginx.conf
dest=/etc/nginx/nginx.conf
- name: Deactivate the default nginx site
file: path=/etc/nginx/sites-enabled/default
state=absent
- name: Generate the stub_status site config
copy: src=files/nginx.status.conf
dest=/etc/nginx/sites-available/status
- name: Activate the stub_status site
file: src=/etc/nginx/sites-available/status
dest=/etc/nginx/sites-enabled/status
state=link
- name: Add site for the app under development
when: app is defined
template: src=templates/nginx.site.conf.j2
dest=/etc/nginx/sites-available/site
- name: Activate the app
when: app is defined
file: src=/etc/nginx/sites-available/site
dest=/etc/nginx/sites-enabled/site
state=link
- name: Configure log rotation
copy: src=files/nginx.logrotate
dest=/etc/logrotate.d/nginx
- name: Copy nginx init script
sudo: yes
copy: src=files/nginx.upstart
dest=/etc/init/nginx.conf
mode=755
- name: Add ufw rule
sudo: yes
command: ufw allow 80,443/tcp
# Note: ufw isn't enabled at this point
- name: Start nginx
command: start nginx