ansible-role-ipa-getcert/templates/get_cert.sh.j2

40 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-12-20 01:12:34 +00:00
#!/bin/bash
# This script will take care of the certificate process for IPA.
# There may be more than one request done based on the vars of the playbook.
{% for ipahosts in ipa_getcert_requested_hostnames %}
2021-01-20 03:08:38 +00:00
{% if ipa_getcert_nss %}
2021-01-20 03:15:41 +00:00
nss_db_path="{{ ipahosts.nss_db_dir | default(ipa_getcert_nss_default_location) }}"
if [ ! -d "${nss_db_path}" && ! -L "${nss_db_path}" ]; then
mkdir -p "${nss_db_path}"
2021-01-20 03:08:38 +00:00
fi
{% endif %}
2020-12-20 01:12:34 +00:00
/usr/bin/ipa-getcert request -r -w \
-I "{{ ipahosts.name }}" \
-N "CN={{ ipahosts.name }}" \
-D "{{ ipahosts.name }}" \
2021-01-22 02:22:55 +00:00
{% if ipahosts.cnames is defined %}
{% for cname in ipahosts.cnames %}
-D "{{ cname }}" \
{% endfor %}
{% endif %}
2021-01-20 03:08:38 +00:00
{% if ipa_getcert_nss %}
2021-01-20 03:15:41 +00:00
-d "${nss_db_path}" \
-n {{ ipahosts.nss_nickname | default(ansible_fqdn) }} \
2021-01-20 03:08:38 +00:00
{% else %}
2020-12-20 01:12:34 +00:00
-k "{{ ipahosts.key_location | default(ipa_getcert_key_default_location) }}" \
-f "{{ ipahosts.cert_location | default(ipa_getcert_cert_default_location) }}" \
2021-01-20 03:08:38 +00:00
{% endif %}
2020-12-20 01:12:34 +00:00
{% if ipahosts.postcmd %}
-C "{{ ipahosts.postcmd }}" \
{% endif %}
{% if ipahosts.owner %}
-O "{{ ipahosts.owner }}" \
-o "{{ ipahosts.owner }}" \
{% endif %}
-K "host/{{ ipahosts.name }}"
{% endfor %}