xoxys.mosquitto/tasks/tls.yml

27 lines
784 B
YAML

---
- block:
- name: Create tls folder structure
file:
path: "{{ item }}"
state: directory
owner: root
group: root
recurse: True
loop:
- "{{ mosquitto_tls_cert_path | dirname }}"
- "{{ mosquitto_tls_key_path | dirname }}"
- name: Copy certs and private key
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
loop:
- { src: "{{ mosquitto_tls_key_source }}", dest: '{{ mosquitto_tls_key_path }}', mode: '0600' }
- { src: "{{ mosquitto_tls_cert_source }}", dest: '{{ mosquitto_tls_cert_path }}', mode: '0750' }
loop_control:
label: "{{ item.dest }}"
notify: __mosquitto_restart
become: True
become_user: root