summaryrefslogtreecommitdiffstats
path: root/roles/common-web/tasks/main.yml
blob: f55770d2954131d4f6f3e13d8eaa1c12cf5bea81 (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
- 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/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 snippet
  copy: src=etc/nginx/include.d/ssl
        dest=/etc/nginx/include.d/ssl
        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