# Generated by ansible.
{% if pacemaker_running %}
{% for controller_unsplit in controllers %}
{% set controller = controller_unsplit.split(',') %}
{% if controller[0] != (ansible_hostname + '.' + network) %}

conn overcloud-{{ network }}-controller-to-controller-tunnel-{{ loop.index0 }}
    left={{ current_ip }}
    leftid=@{{ ansible_hostname }}.{{ network }}
    right={{ controller[1] }}
    rightid=@{{ controller[0] }}
    authby=secret
    auto=start
    dpdaction=hold
    dpddelay=5
    dpdtimeout=15
    phase2alg={{ ipsec_algorithm }}
    failureshunt=drop
{% endif %}
{% endfor %}

conn overcloud-{{ network }}-controller-to-compute-tunnel
    left={{ current_ip }}
    leftid=@{{ ansible_hostname }}.{{ network }}
    right=%any
    rightid=@computecluster
    authby=secret
    auto=add
    dpdaction=hold
    dpddelay=5
    dpdtimeout=15
    phase2alg={{ ipsec_algorithm }}
    failureshunt=drop

{% else %}
{% for controller_unsplit in controllers %}
{% set controller = controller_unsplit.split(',') %}

conn overcloud-{{ network }}-controller-to-compute-tunnel-{{ loop.index0 }}
    left={{ current_ip }}
    leftid=@computecluster
    right={{ controller[1] }}
    rightid=@{{ controller[0] }}
    authby=secret
    auto=start
    dpdaction=hold
    dpddelay=5
    dpdtimeout=15
    phase2alg={{ ipsec_algorithm }}
    failureshunt=drop
{% endfor %}
{% endif %}
