tripleo-ansible/tripleo_ansible/roles/tripleo_unbound/templates/unbound_build_vars.j2

42 lines
1.9 KiB
Django/Jinja

# {{ ansible_managed }}
{#
This template is for the TripleO base Unbound configuration file.
No service specific settings should be made in this file.
This template will generate the required variables needed for the Unbound
configuration file template.
We were requested to handle the variables in a jinja template instead of in
the ansible task due to an ansible performance issue here:
https://review.opendev.org/c/openstack/tripleo-ansible/+/773784
#}
{# Get the unbound listen interface IP address #}
{% if tripleo_unbound_listen_interfaces is not defined or tripleo_unbound_listen_interfaces == "" %}
{% if tripleo_unbound_network_name is defined and tripleo_unbound_network_name != "" %}
{% set tripleo_unbound_listen_interfaces = [hostvars[inventory_hostname][tripleo_unbound_network_name + "_ip"]] %}
{% else %}
{% set tripleo_unbound_listen_interfaces = ['127.0.0.1'] %}
{% endif %}
{% endif %}
{# Get the cloud "external" subnet CIDRs to allow for queries #}
{% if tripleo_unbound_allowed_external_cidrs is not defined or tripleo_unbound_allowed_external_cidrs == "" %}
{% if tripleo_unbound_external_network_name is defined and tripleo_unbound_external_network_name != "" %}
{% set tripleo_unbound_allowed_external_cidrs = vars['net_cidr_map'][tripleo_unbound_external_network_name] %}
{% else %}
{% set tripleo_unbound_allowed_external_cidrs = [] %}
{% endif %}
{% endif %}
{# Get the cloud "internal" subnet CIDRs to allow for queries #}
{% if tripleo_unbound_allowed_internal_cidrs is not defined or tripleo_unbound_allowed_internal_cidrs == "" %}
{% if tripleo_unbound_internal_network_name is defined and tripleo_unbound_internal_network_name != "" %}
{% set tripleo_unbound_allowed_internal_cidrs = vars['net_cidr_map'][tripleo_unbound_internal_network_name] %}
{% else %}
{% set tripleo_unbound_allowed_internal_cidrs = [] %}
{% endif %}
{% endif %}