Merge "Add a single variable for combined networks"

This commit is contained in:
Zuul 2018-06-01 22:01:38 +00:00 committed by Gerrit Code Review
commit f08146b377
4 changed files with 20 additions and 5 deletions

View File

@ -336,7 +336,7 @@
Domains: "{{ container_domain }}"
systemd_networks: |-
{% set _networks = [] %}
{% for _, value in (container_networks | combine(nspawn_networks)).items() %}
{% for _, value in nspawn_combined_networks.items() %}
{% if value.bridge is defined %}
{% set _network = {'interface': 'mv-mv-' + value.bridge.split('br-')[-1]} %}
{% else %}

View File

@ -24,8 +24,7 @@ Bind={{ bind }}:{{ bind }}
[Network]
{% set macvlans = [] %}
{% set _ = container_networks.update(nspawn_networks) %}
{% for key, value in container_networks.items() %}
{% for key, value in nspawn_combined_networks.items() %}
{% if value.bridge is defined %}
{% set _ = macvlans.append('mv-' + value.bridge.split('br-')[-1]) %}
{% endif %}

View File

@ -18,8 +18,7 @@
{% endfor %}
{% endif %}
{% set macvlans = [] %}
{% set _ = container_networks.update(nspawn_networks) %}
{% for key, value in container_networks.items() %}
{% for key, value in nspawn_combined_networks.items() %}
{% if value.bridge is defined %}
{% set macvlan = 'mv-' + value.bridge.split('br-')[-1] %}
{% endif %}

17
vars/main.yml Normal file
View File

@ -0,0 +1,17 @@
---
# Copyright 2018, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# A combined hash of all networks to be used within a deployment.
nspawn_combined_networks: "{{ container_networks | combine(container_extra_networks | default({})) | combine(nspawn_networks) }}"