summaryrefslogtreecommitdiff
path: root/roles/nginx/base/tasks/main.yml
blob: a075e81d42f5e0f1eff450dbe8975560c938533c (plain) (blame)
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
---
- name: install nginx
  apt:
    name: "{{ nginx_pkg_variant | default((ansible_distribution == 'Ubuntu') | ternary('nginx-core', 'nginx-light')) }}"
    state: present

- name: remove nginx default config
  file:
    name: /etc/nginx/sites-enabled/default
    state: absent
  notify: restart nginx

- name: install nginx config.d files
  loop: "{{ nginx_conf_d_files }}"
  copy:
    src: "conf.d/{{ item }}.conf"
    dest: /etc/nginx/conf.d/
  notify: restart nginx

- name: install nginx config snippets
  loop: "{{ nginx_snippets }}"
  copy:
    src: "snippets/{{ item }}.conf"
    dest: /etc/nginx/snippets/
  notify: restart nginx

- name: generate Diffie-Hellman parameters
  openssl_dhparam:
    path: /etc/ssl/dhparams.pem
    size: "{{ nginx_dhparam_size }}"
  notify: restart nginx

- name: install and setup stream module
  when: nginx_stream_module
  import_tasks: stream.yml

- name: configure server_names_hash_bucket_size
  when: nginx_server_names_hash_bucket_size is defined
  lineinfile:
    regexp: "^(\\s*)#?\\s*server_names_hash_bucket_size\\s"
    line: "\\1server_names_hash_bucket_size {{ nginx_server_names_hash_bucket_size }};"
    dest: /etc/nginx/nginx.conf
    backrefs: yes
  notify: restart nginx