xoxys.ucs/tasks/tls.yml

65 lines
2.0 KiB
YAML
Raw Normal View History

2018-08-04 20:23:06 +00:00
---
- block:
- name: Create tls folder structure
file:
path: "{{ item }}"
state: directory
mode: 700
with_items:
- "{{ ucs_tls_certs_dir }}"
- "{{ ucs_tls_key_dir }}"
- name: Copy certs and private key
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{item.mode }}"
with_items:
2018-08-04 21:04:04 +00:00
- { src: "{{ ucs_tls_cert_path }}", dest: "{{ ucs_tls_certs_dir }}/ucs.pem", mode: '0600' }
- { src: "{{ ucs_tls_key_path }}", dest: "{{ ucs_tls_key_dir }}/ucs.pem", mode: '0750' }
2018-08-04 20:34:33 +00:00
loop_control:
label: "{{ item.dest }}"
2018-08-04 21:46:05 +00:00
notify:
- __ucs_apache_restart
- __ucs_dov_restart
- __ucs_postfix_restart
2018-08-04 20:48:43 +00:00
2018-08-04 21:30:31 +00:00
- name: Set apache2 ucr vars
2018-08-04 20:48:43 +00:00
ucr:
path: "{{ item.path }}"
value: "{{ item.value }}"
with_items:
- { path: apache2/ssl/certificate, value: "{{ ucs_tls_certs_dir }}/ucs.pem" }
- { path: apache2/ssl/key, value: "{{ ucs_tls_key_dir }}/ucs.pem" }
2018-08-04 21:39:34 +00:00
loop_control:
label: "variable: {{ item.path }}={{ item.value }}"
2018-08-04 20:59:37 +00:00
notify: __ucs_apache_restart
when: ucs_custom_tls_apache2_enabled
2018-08-04 21:30:31 +00:00
- name: Set dovecot ucr vars
ucr:
path: "{{ item.path }}"
value: "{{ item.value }}"
with_items:
- { path: mail/dovecot/ssl/certificate, value: "{{ ucs_tls_certs_dir }}/ucs.pem" }
- { path: mail/dovecot/ssl/key, value: "{{ ucs_tls_key_dir }}/ucs.pem" }
2018-08-04 21:39:34 +00:00
loop_control:
label: "variable: {{ item.path }}={{ item.value }}"
2018-08-04 21:30:31 +00:00
notify: __ucs_dovecot_restart
when: ucs_custom_tls_dovecot_enabled
2018-08-04 21:30:31 +00:00
- name: Set postfix ucr vars
ucr:
path: "{{ item.path }}"
value: "{{ item.value }}"
with_items:
- { path: mail/postfix/ssl/certificate, value: "{{ ucs_tls_certs_dir }}/ucs.pem" }
- { path: mail/postfix/ssl/key, value: "{{ ucs_tls_key_dir }}/ucs.pem" }
2018-08-04 21:39:34 +00:00
loop_control:
label: "variable: {{ item.path }}={{ item.value }}"
2018-08-04 21:30:31 +00:00
notify: __ucs_postfix_restart
when: ucs_custom_tls_postfix_enabled
2018-08-04 20:23:06 +00:00
become: True
become_user: root
2018-08-04 21:31:40 +00:00
when: ucs_custom_tls_enabled