Add VLAN id to ansible group_vars

Read the VLAN id of the subnet tag's and populate the
{{network.name_lower}}_vlan_id group var.

The VLAN id is added to subnet tags in the depends-on
change.

Depends-On: https://review.opendev.org/750666
Change-Id: I09233e84e022433220f2fa7b6758368191880566
This commit is contained in:
Harald Jensås 2020-09-22 17:48:18 +02:00
parent f4867675c4
commit f7e35f9fca
1 changed files with 15 additions and 2 deletions

View File

@ -961,10 +961,24 @@ resources:
{{network.name_lower}}_gateway_ip: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, gateway_ip]}
{{network.name_lower}}_host_routes: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, host_routes]}
{{network.name_lower}}_cidr: {str_split: ['/', {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, cidr]}, 1]}
{{network.name_lower}}_vlan_id:
yaql:
expression: >
switch(not isList($.data) => 1,
not $.data.where($.startsWith('tripleo_vlan_id')).len() => 1,
true => int($.data.where($.startsWith('tripleo_vlan_id')).first().split('=').last()))
data: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{role.networks[network.name]['subnet']}}, tags]}
{%- else %}
{{network.name_lower}}_gateway_ip: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, gateway_ip]}
{{network.name_lower}}_host_routes: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, host_routes]}
{{network.name_lower}}_cidr: {str_split: ['/', {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, cidr]}, 1]}
{{network.name_lower}}_vlan_id:
yaql:
expression: >
switch(not isList($.data) => 1,
not $.data.where($.startsWith('tripleo_vlan_id')).len() => 1,
true => int($.data.where($.startsWith('tripleo_vlan_id')).first().split('=').last()))
data: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{network.name_lower}}_subnet, tags]}
{%- endif %}
{%- endfor %}
network_cidrs:
@ -991,8 +1005,7 @@ resources:
default_route_networks: {{role.default_route_networks}}
networks_skip_config: {{role.networks_skip_config }}
role_tags: {{role.tags}}
{% endfor %}
{%- endfor %}
ControlVirtualIP:
depends_on: ServiceNetMap