Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions roles/radvd/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@
- "'AdvAutonomous on' in _config"
- "'AdvRouterAddr on' in _config"

- name: Verify testnet1 configuration formatting is correct
vars:
_config_lines: "{{ (_testnet1_conf.content | b64decode).split('\n') }}"
ansible.builtin.assert:
that:
# Check directives are on separate lines (not squished together)
- _config_lines | select('match', '.*;.*AdvManagedFlag') | list | length == 0
- _config_lines | select('match', '.*;.*AdvOtherConfigFlag') | list | length == 0
- _config_lines | select('match', '.*;.*AdvLinkMTU') | list | length == 0
# Check specific lines have proper formatting (one directive per line)
- _config_lines | select('match', '^ AdvManagedFlag on;$') | list | length == 1
- _config_lines | select('match', '^ AdvOtherConfigFlag on;$') | list | length == 1
- _config_lines | select('match', '^ AdvLinkMTU 1500;$') | list | length == 1
msg: "Configuration formatting is incorrect - directives may be squished together on the same line"

- name: Verify testnet2 configuration has RDNSS
become: true
ansible.builtin.slurp:
Expand Down
60 changes: 30 additions & 30 deletions roles/radvd/templates/network.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,60 @@
interface {{ cifmw_radvd_network.name }}
{
AdvSendAdvert {{ (cifmw_radvd_network.adv_send_advert | default(true)) | ternary('on', 'off') }};
{%- if cifmw_radvd_network.adv_managed_flag is defined %}
{% if cifmw_radvd_network.adv_managed_flag is defined %}
AdvManagedFlag {{ cifmw_radvd_network.adv_managed_flag | ternary('on', 'off') }};
{%- endif %}
{%- if cifmw_radvd_network.adv_other_config_flag is defined %}
{% endif %}
{% if cifmw_radvd_network.adv_other_config_flag is defined %}
AdvOtherConfigFlag {{ cifmw_radvd_network.adv_other_config_flag | ternary('on', 'off') }};
{%- endif %}
{%- if cifmw_radvd_network.adv_ra_solicited_unicast is defined %}
{% endif %}
{% if cifmw_radvd_network.adv_ra_solicited_unicast is defined %}
AdvRASolicitedUnicast {{ cifmw_radvd_network.adv_ra_solicited_unicast | ternary('on', 'off') }};
{%- endif %}
{%- if cifmw_radvd_network.adv_link_mtu is defined %}
{% endif %}
{% if cifmw_radvd_network.adv_link_mtu is defined %}
AdvLinkMTU {{ cifmw_radvd_network.adv_link_mtu }};
{%- endif %}
{%- if cifmw_radvd_network.min_rtr_adv_interval is defined %}
{% endif %}
{% if cifmw_radvd_network.min_rtr_adv_interval is defined %}
MinRtrAdvInterval {{ cifmw_radvd_network.min_rtr_adv_interval }};
{%- endif %}
{%- if cifmw_radvd_network.max_rtr_adv_interval is defined %}
{% endif %}
{% if cifmw_radvd_network.max_rtr_adv_interval is defined %}
MaxRtrAdvInterval {{ cifmw_radvd_network.max_rtr_adv_interval }};
{%- endif %}
{%- for prefix in cifmw_radvd_network.prefixes | default([]) %}
{% endif %}
{% for prefix in cifmw_radvd_network.prefixes | default([]) %}
prefix {{ prefix.network }}
{
AdvOnLink {{ (prefix.adv_on_link | default(true)) | ternary('on', 'off') }};
AdvAutonomous {{ (prefix.adv_autonomous | default(true)) | ternary('on', 'off') }};
{%- if prefix.adv_router_addr is defined %}
{% if prefix.adv_router_addr is defined %}
AdvRouterAddr {{ prefix.adv_router_addr | ternary('on', 'off') }};
{%- endif %}
{%- if prefix.adv_valid_lifetime is defined %}
{% endif %}
{% if prefix.adv_valid_lifetime is defined %}
AdvValidLifetime {{ prefix.adv_valid_lifetime }};
{%- endif %}
{%- if prefix.adv_preferred_lifetime is defined %}
{% endif %}
{% if prefix.adv_preferred_lifetime is defined %}
AdvPreferredLifetime {{ prefix.adv_preferred_lifetime }};
{%- endif %}
{% endif %}
};

{%- endfor %}
{%- for route in cifmw_radvd_network.routes | default([]) %}
{% endfor %}
{% for route in cifmw_radvd_network.routes | default([]) %}
route {{ route.network }}
{
{%- if route.adv_route_preference is defined %}
{% if route.adv_route_preference is defined %}
AdvRoutePreference {{ route.adv_route_preference }};
{%- endif %}
{%- if route.adv_route_lifetime is defined %}
{% endif %}
{% if route.adv_route_lifetime is defined %}
AdvRouteLifetime {{ route.adv_route_lifetime }};
{%- endif %}
{% endif %}
};

{%- endfor %}
{%- for rdnss in cifmw_radvd_network.rdnss | default([]) %}
{% endfor %}
{% for rdnss in cifmw_radvd_network.rdnss | default([]) %}
RDNSS {{ rdnss.servers | join(' ') }}
{
{%- if rdnss.adv_rdnss_lifetime is defined %}
{% if rdnss.adv_rdnss_lifetime is defined %}
AdvRDNSSLifetime {{ rdnss.adv_rdnss_lifetime }};
{%- endif %}
{% endif %}
};

{%- endfor %}
{% endfor %}
};