2016-09-27 19:33:52 +02:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: Create the snippets directory
|
|
|
|
file: dest={{ nginx_snippets_dir }} state=directory
|
|
|
|
|
2017-08-18 15:47:17 +02:00
|
|
|
- name: Create the pki directory
|
2017-09-01 19:03:56 +02:00
|
|
|
file: dest={{ pki_dir }}/nginx state=directory
|
2017-08-18 15:47:17 +02:00
|
|
|
|
|
|
|
- name: Create a dhparams file 2048 bits long
|
|
|
|
shell: openssl dhparam -out {{ pki_dir }}/nginx/dhparams.pem 2048
|
|
|
|
args:
|
|
|
|
creates: '{{ pki_dir }}/nginx/dhparams.pem'
|
|
|
|
when: nginx_ssl_level == 'intermediate'
|
|
|
|
notify: Reload nginx
|
|
|
|
|
2016-09-27 19:33:52 +02:00
|
|
|
- name: remove nginx default virtualhost
|
|
|
|
file: dest=/etc/nginx/sites-enabled/default state=absent
|
|
|
|
notify: Reload nginx
|
|
|
|
|
|
|
|
- name: Install the supported configuration snippets
|
|
|
|
template: src={{ item }}.j2 dest=/etc/nginx/snippets/{{ item }} owner=root group=root mode=0444
|
|
|
|
with_items: '{{ nginx_conf_snippets }}'
|
|
|
|
|
|
|
|
- name: Install the main nginx.conf
|
|
|
|
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf mode=444
|
|
|
|
notify: Reload nginx
|
|
|
|
|
2016-10-03 18:27:39 +02:00
|
|
|
- name: Remove the old configuration snippets
|
|
|
|
file: dest=/etc/nginx/conf.d/{{ item }} state=absent
|
|
|
|
with_items: '{{ nginx_old_snippets }}'
|
|
|
|
|
2016-09-27 19:33:52 +02:00
|
|
|
when: nginx_enabled
|
|
|
|
tags: [ 'nginx', 'nginx_conf', 'nginx_virtualhost' ]
|