ansible-role-pki/vars/main.yml

51 lines
2.1 KiB
YAML

---
# Copyright 2021, BBC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Gather CA definitions from hostvars
_pki_ca_defs: |-
{% set _cas = pki_authorities %}
{% set _ca_search_hits = vars.keys() | select('match', '^' ~ pki_search_authorities_pattern ~ '.*') %}
{% for _ca in _ca_search_hits | default([]) %}
{% set _ = _cas.extend(lookup('vars', _ca)) %}
{% endfor %}
{{ _cas | rejectattr('condition', 'false') }}
# Gather CA installation definitions from hostvars
_pki_install_ca_defs: |-
{% set _cas = pki_install_ca %}
{% set _ca_search_hits = vars.keys() | select('match', '^' ~ pki_search_install_ca_pattern ~ '.*') %}
{% for _ca in _ca_search_hits | default([]) %}
{% set _ = _cas.extend(lookup('vars', _ca)) %}
{% endfor %}
{{ _cas | rejectattr('condition', 'false') }}
# Gather certificate definitions from hostvars
_pki_certificates_defs: |
{% set _certs = pki_certificates %}
{% set _cert_search_hits = vars.keys() | select('match', '^' ~ pki_search_certificates_pattern ~ '.*') %}
{% for _cert in _cert_search_hits | default([]) %}
{% set _ = _certs.extend(lookup('vars', _cert)) %}
{% endfor %}
{{ _certs | rejectattr('condition', 'false') }}
# Gather certificate installation definitions from hostvars
_pki_install_certificates_defs: |
{% set _certs = pki_install_certificates %}
{% set _cert_search_hits = vars.keys() | select('match', '^' ~ pki_search_install_certificates_pattern ~ '.*') %}
{% for _cert in _cert_search_hits | default([]) %}
{% set _ = _certs.extend(lookup('vars', _cert)) %}
{% endfor %}
{{ _certs | rejectattr('condition', 'false') }}