2018-08-11 12:59:43 +00:00
|
|
|
- block:
|
2018-08-12 09:31:12 +00:00
|
|
|
- name: Create tls folder structure
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
2018-08-14 18:49:29 +00:00
|
|
|
mode: 750
|
2018-08-12 09:31:12 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ nginx_tls_certs_dir }}"
|
|
|
|
- "{{ nginx_tls_key_dir }}"
|
2018-08-11 12:59:43 +00:00
|
|
|
|
2018-08-12 09:31:12 +00:00
|
|
|
- name: Copy certs and private key (content)
|
2018-08-11 12:59:43 +00:00
|
|
|
copy:
|
2018-08-12 09:31:12 +00:00
|
|
|
content: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
mode: "{{ item.mode }}"
|
|
|
|
with_items:
|
|
|
|
- { src: "{{ nginx_tls_key_source }}", dest: '{{ nginx_tls_key_file }}', mode: '0600' }
|
|
|
|
- { src: "{{ nginx_tls_cert_source }}", dest: '{{ nginx_tls_cert_file }}', mode: '0750' }
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.dest }}"
|
|
|
|
notify: __nginx_reload
|
|
|
|
when: nginx_tls_source_use_content
|
2018-08-11 12:59:43 +00:00
|
|
|
|
2018-08-12 09:31:12 +00:00
|
|
|
- name: Copy certs and private key (files)
|
2018-08-11 12:59:43 +00:00
|
|
|
copy:
|
2018-08-12 09:31:12 +00:00
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
mode: "{{ item.mode }}"
|
|
|
|
with_items:
|
|
|
|
- { src: "{{ nginx_tls_key_source }}", dest: '{{ nginx_tls_key_file }}', mode: '0600' }
|
|
|
|
- { src: "{{ nginx_tls_cert_source }}", dest: '{{ nginx_tls_cert_file }}', mode: '0750' }
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.dest }}"
|
|
|
|
notify: __nginx_reload
|
|
|
|
when: nginx_tls_source_use_files
|
2018-08-11 12:59:43 +00:00
|
|
|
become: True
|
|
|
|
become_user: root
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Register dhparam file
|
|
|
|
stat:
|
|
|
|
path: "{{ nginx_dhparam_file }}"
|
2018-08-12 09:31:12 +00:00
|
|
|
register: __nginx_dh_file
|
2018-08-11 12:59:43 +00:00
|
|
|
|
|
|
|
- name: Generate Diffie-Hellman parameter file
|
|
|
|
shell: "/usr/bin/openssl dhparam -out '{{ nginx_dhparam_file }}' {{ nginx_dhparam_size }}"
|
|
|
|
async: 3600
|
|
|
|
poll: 60
|
2018-08-12 09:31:12 +00:00
|
|
|
when: not __nginx_dh_file.stat.exists
|
|
|
|
notify: __nginx_reload
|
2018-08-11 12:59:43 +00:00
|
|
|
become: True
|
|
|
|
become_user: root
|
|
|
|
when: nginx_pfs_enabled
|