xoxys.unifi/tasks/tls.yml

66 lines
1.8 KiB
YAML
Raw Normal View History

2018-07-12 23:02:27 +02:00
---
2018-08-14 21:02:18 +02:00
- block:
- name: Create tls folder structure
file:
path: "{{ item }}"
state: directory
2018-08-14 21:26:37 +02:00
owner: "{{ unifi_user }}"
group: "{{ unifi_group }}"
recurse: True
2018-08-14 21:02:18 +02:00
with_items:
- "{{ unifi_tls_certs_dir }}"
- "{{ unifi_tls_key_dir }}"
2018-08-14 21:26:37 +02:00
become: True
become_user: root
2018-08-14 21:02:18 +02:00
- import_tasks: tls_from_file.yml
when: unifi_tls_source_use_files
- import_tasks: tls_from_content.yml
when: unifi_tls_source_use_content
2018-07-13 00:04:34 +02:00
2018-07-12 23:02:27 +02:00
- block:
2018-07-13 00:04:34 +02:00
- set_fact:
__unifi_pkcs12_path: /tmp/unifi.p12
__unifi_keystore_path: "{{ unifi_base_dir }}/{{ unifi_version }}//UniFi/data/keystore"
- name: Create temp openssl pkcs12 keystore at '{{ __unifi_pkcs12_path }}'
2018-07-12 23:02:27 +02:00
openssl_pkcs12:
2018-07-13 00:04:34 +02:00
path: "{{ __unifi_pkcs12_path }}"
2018-07-12 23:02:27 +02:00
friendly_name: ubnt
2018-08-14 21:02:18 +02:00
privatekey_path: "{{ unifi_tls_key_file }}"
2018-08-14 21:37:18 +02:00
cert_path: "{{ unifi_tls_cert_file }}"
2018-07-12 23:26:37 +02:00
passphrase: "{{ unifi_tls_pkcs12_passphrase }}"
2018-07-12 23:02:27 +02:00
state: present
2018-07-13 00:04:34 +02:00
- name: Delete current keystore file
file:
path: "{{ __unifi_keystore_path }}"
state: absent
- name: Create java keystore at '{{ __unifi_keystore_path }}'
2018-07-13 00:10:56 +02:00
java_cert:
2018-07-13 00:44:09 +02:00
pkcs12_path: "{{ __unifi_pkcs12_path }}"
2018-07-13 00:04:34 +02:00
cert_alias: ubnt
2018-07-13 00:52:30 +02:00
pkcs12_alias: ubnt
2018-07-13 00:04:34 +02:00
keystore_path: "{{ __unifi_keystore_path }}"
keystore_pass: aircontrolenterprise
2018-07-13 00:05:54 +02:00
pkcs12_password: "{{ unifi_tls_pkcs12_passphrase }}"
2018-07-13 00:04:34 +02:00
keystore_create: yes
state: present
notify: __unifi_restart
- name: Adjust keystore filesystem permissions
file:
path: "{{ __unifi_keystore_path }}"
owner: "{{ unifi_user }}"
group: "{{ unifi_group }}"
mode: 0600
- name: Remove '{{ __unifi_pkcs12_path }}'
file:
path: "{{ __unifi_pkcs12_path }}"
state: absent
2018-07-12 23:02:27 +02:00
become: True
2018-08-14 21:26:37 +02:00
become_user: "{{ unifi_user }}"
2018-08-14 22:45:19 +02:00
when: __unifi_certs_file.changed or __unifi_certs_content.changed