summaryrefslogtreecommitdiffstats
path: root/roles/common-web/tasks/main.yml
blob: 41cfa46d854fdc40da39225e80855917eeed6f3d (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
- 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: Start Nginx
  service: name=nginx state=started
  when: not (r1.changed or r2.changed)

- meta: flush_handlers