mongodb: Better way to create combined cert/key
This commit is contained in:
parent
4177cc3cf3
commit
5abdba0e9b
1 changed files with 13 additions and 13 deletions
|
@ -55,23 +55,23 @@
|
|||
state: link
|
||||
follow: false
|
||||
|
||||
- name: create combined certificate/private key file
|
||||
ansible.builtin.shell:
|
||||
cmd: >-
|
||||
umask 077 &&
|
||||
/bin/cat \
|
||||
{{ tls_certs }}/{{ inventory_hostname }}.crt \
|
||||
{{ tls_private }}/{{ inventory_hostname }}.key > \
|
||||
{{ tls_private }}/mongodb.pem
|
||||
creates: "{{ tls_private }}/mongodb.pem"
|
||||
notify: restart mongod
|
||||
- name: generate combined certificate/private key file contents
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /bin/cat
|
||||
- "{{ tls_certs }}/{{ inventory_hostname }}.crt"
|
||||
- "{{ tls_private }}/{{ inventory_hostname }}.key"
|
||||
failed_when: false
|
||||
register: mongodb_cert_key
|
||||
|
||||
- name: fix certificate/key file permissions
|
||||
ansible.builtin.file:
|
||||
path: "{{ tls_private }}/mongodb.pem"
|
||||
- name: create combined certificate/private key file
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ tls_private }}/mongodb.pem"
|
||||
content: "{{ mongodb_cert_key.stdout }}"
|
||||
mode: 0640
|
||||
owner: root
|
||||
group: mongod
|
||||
notify: restart mongod
|
||||
|
||||
- name: configure logrotate
|
||||
ansible.builtin.copy:
|
||||
|
|
Loading…
Add table
Reference in a new issue