summaryrefslogtreecommitdiffstats
path: root/roles/common-web/tasks/main.yml
blob: 1f8655ab69e7a8988828ff0b75540db6a0ee5e23 (plain)
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
61
62
63
64
65
66
67
68
69
- name: Install Nginx
  apt: pkg=nginx

- name: Limit Nginx logging
  lineinfile: "dest=/etc/logrotate.d/nginx create=yes
               regexp='^\\s*rotate\\s'
               line='\trotate 1'"
  tags:
    - logrotate

- name: Delete /etc/nginx/*_params
  file: path=/etc/nginx/{{ item }}_params state=absent
  with_items:
    - fastcgi
    - proxy
    - scgi
    - uwsgi

- name: Delete /etc/nginx/sites-{available,enabled}/default
  file: path=/etc/nginx/sites-{{ item }}/default state=absent
  with_items:
    - enabled
    - available

- name: Create directory /etc/nginx/{fastcgi,ssl}
  file: path=/etc/nginx/{{ item }}
        state=directory
        owner=root group=root
        mode=0755
  with_items:
    - fastcgi
    - ssl

- name: Copy fastcgi parameters
  copy: src=etc/nginx/fastcgi/{{ item }}
        dest=/etc/nginx/fastcgi/{{ item }}
        owner=root group=root
        mode=0644
  register: r1
  with_items:
    - params
    - php
    - php-ssl
  notify:
    - Restart Nginx

- name: Copy SSL configuration
  copy: src=etc/nginx/ssl/config
        dest=/etc/nginx/ssl/config
        owner=root group=root
        mode=0644
  register: r2
  notify:
    - Restart Nginx

- name: Add .asc to text/plain MIME types
  lineinfile: dest=/etc/nginx/mime.types
              regexp='^(\s*text/plain\s+)'
              backrefs=yes
              line='\1txt asc;'
  register: r3
  notify:
    - Restart Nginx

- name: Start Nginx
  service: name=nginx state=started
  when: not (r1.changed or r2.changed or r3.changed)

- meta: flush_handlers