aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nginx/tasks/nginx.yml
blob: fdc91c863e361bd0ebf08f60c7a38d7de4ea39b2 (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
---

- name: Ensure Apache HTTP is Not Installed
  apt: name=apache2 state=absent

- name: Install nginx
  apt: name=nginx state=present

- name: Create default nginx content directory
  file: path=/srv/http/default/www
        state=directory
        owner=www-data
        group=www-data
        mode=0775
        recurse=yes

- name: Setup default nginx pages
  copy:
    src: "{{item.src}}"
    dest: "/srv/http/default/www/{{item.dest}}"
    owner: www-data
    group: www-data
    force: no
  with_items:
    - {src: "{{ nginx_default_404 }}",      dest: "404.html"}
    - {src: "{{ nginx_default_50x }}",      dest: "50x.html"}
    - {src: "{{ nginx_default_favicon }}",  dest: "favicon.png"}
    - {src: "{{ nginx_default_index }}",    dest: "index.html"}

- name: Copy generic (default) nginx site configuration
  template: src=etc_nginx_sites-available_default.j2
            dest=/etc/nginx/sites-available/default

- name: Create nginx symlink for default
  file: state=link
        src=/etc/nginx/sites-available/default
        dest=/etc/nginx/sites-enabled/default
  notify: nginx restart     # reload not sufficient?