summaryrefslogtreecommitdiff
path: root/roles/x509/selfsigned/cert/prepare/templates/updated.sh.j2
blob: 0842c527785cfd1d3c6e5cf1728a4bb89342083a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
{% if 'install' in x509_certificate_renewal %}
{%   for file in x509_certificate_renewal.install %}

install{% if 'mode' in file %} -m {{ file.mode }}{% endif %}{% if 'owner' in file %} -o {{ file.owner }}{% endif %}{% if 'group' in file %} -g {{ file.group }}{% endif %} /dev/null "{{ file.dest }}.new"
{%     for src in file.src %}
{%       set src_file = lookup('vars', 'x509_certificate_path_' + src) %}
{%       if src_file != "" %}
cat "{{ src_file }}" >> "{{ file.dest }}.new"
{%       endif %}
{%     endfor %}
mv "{{ file.dest }}.new" "{{ file.dest }}"
{%   endfor %}
{% endif %}
{% if 'reload' in x509_certificate_renewal %}

{{ x509_certificate_renewal.reload | trim }}
{% endif %}