xoxys.postgres/tasks/tls.yml

42 lines
1.3 KiB
YAML
Raw Normal View History

2018-10-16 23:05:15 +02:00
---
- block:
- name: Create tls folder structure
file:
path: "{{ item }}"
state: directory
2018-10-16 23:14:12 +02:00
owner: "{{ postgres_user }}"
2018-10-16 23:13:18 +02:00
group: "{{ postgres_group }}"
2018-10-16 23:05:15 +02:00
recurse: True
with_items:
2018-10-16 23:11:31 +02:00
- "{{ __postgres_tls_key_path | dirname }}"
- "{{ __postgres_tls_cert_path | dirname }}"
2018-10-16 23:05:15 +02:00
become: True
become_user: root
- block:
- name: Copy certs and private key (file)
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
with_items:
- { src: "{{ postgres_tls_key_source }}", dest: '{{ __postgres_tls_key_path }}', mode: '0600' }
- { src: "{{ postgres_tls_cert_source }}", dest: '{{ __postgres_tls_cert_path }}', mode: '0750' }
loop_control:
label: "{{ item.dest }}"
when: postgres_tls_source_use_files
- name: Copy certs and private key (content)
copy:
content: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
with_items:
- { src: "{{ postgres_tls_key_source }}", dest: '{{ __postgres_tls_key_path }}', mode: '0600' }
- { src: "{{ postgres_tls_cert_source }}", dest: '{{ __postgres_tls_cert_path }}', mode: '0750' }
loop_control:
label: "{{ item.dest }}"
when: postgres_tls_source_use_content
become: True
become_user: "{{ postgres_user }}"