Skip to content
Snippets Groups Projects
Commit 5879fede authored by Alexander Käb's avatar Alexander Käb
Browse files

fix(certs): Fix node cert SAN template structure and variable assignment

parent dddd714b
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ sidecar_cert_dir: "/etc/graylog/sidecar" ...@@ -18,7 +18,7 @@ sidecar_cert_dir: "/etc/graylog/sidecar"
cert_valid_days: 1095 cert_valid_days: 1095
# Cert SAN settings # Cert SAN settings
node_cert_sans: "{{ lookup('template', 'node-cert-sans.j2') }}" node_cert_sans: "{{ lookup('template', 'node-cert-sans.j2') | replace('\n', '') | split(',') | map('trim') | list }}"
use_ipv4: true use_ipv4: true
use_ipv6: true use_ipv6: true
use_default: true use_default: true
......
{%- macro ansible_iface(name) -%} DNS:{{ inventory_hostname }},
ansible_{{name}} DNS:{{ ansible_fqdn }},
{%- endmacro -%} {%- if use_default == true -%}
{%- if use_ipv4 == true and ansible_default_ipv4.address is defined -%}
- "DNS:{{ inventory_hostname }}" IP:{{ ansible_default_ipv4.address }},
- "DNS:{{ ansible_fqdn }}" {%- endif -%}
{% if use_default == true -%} {%- if use_ipv6 == true and ansible_default_ipv6.address is defined -%}
{% if use_ipv4 == true and ansible_default_ipv4.address is defined -%} IP:{{ ansible_default_ipv6.address }},
- "IP:{{ ansible_default_ipv4.address }}" {%- endif -%}
{% endif -%} {%- endif -%}
{% if use_ipv6 == true and ansible_default_ipv6.address is defined -%} {%- if use_interface_ip == true -%}
- "IP:{{ ansible_default_ipv6.address }}" {%- if ansible_facts[iface_name] is defined -%}
{% endif -%} {%- if use_ipv4 == true and ansible_facts[iface_name].ipv4.address is defined -%}
{% endif -%} IP:{{ ansible_facts[iface_name].ipv6.address }},
{% if use_interface_ip == true -%} {%- endif -%}
{% if ansible_facts[ansible_iface(iface_name)] is defined -%} {%- if use_ipv6 == true and (ansible_facts[iface_name].ipv6 | selectattr("scope", "equalto", "global") | length > 0) -%}
{% if use_ipv4 == true and ansible_facts[ansible_iface(iface_name)].ipv4.address is defined -%} {%- for ip in (ansible_facts[iface_name].ipv6 | selectattr("scope", "equalto", "global"))%}
- "IP:{{ ansible_facts[ansible_iface(iface_name)].ipv6.address }}" IP:{{ ip.address }}{% if not loop.last %},{% endif %}
{% endif -%} {%- endfor -%}
{% if use_ipv6 == true and ansible_facts[ansible_iface(iface_name)].ipv6.address is defined -%}
- "IP:{{ ansible_facts[ansible_iface(iface_name)].ipv6.address }}"
{%- endif -%} {%- endif -%}
{%- endif-%} {%- endif-%}
{%- endif -%} {%- endif -%}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment