container: Allow custom ip addresses for more than one network
This commit is contained in:
27
roles/container/vars/main/network.yaml
Normal file
27
roles/container/vars/main/network.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
_container_networks: >-
|
||||
{{
|
||||
container_networks
|
||||
| map(attribute='name')
|
||||
| map('regex_replace', '$', '.network')
|
||||
| zip(container_networks | map(attribute='ip', default=''))
|
||||
| map('reject', 'equalto', '')
|
||||
| map('join', ':ip=')
|
||||
}}
|
||||
|
||||
_container_network_subnet: >-
|
||||
{{ network.ip | ansible.utils.ipsubnet(24) if network.ip | default('') | length > 0 else '' }}
|
||||
_container_network_subnet_ranges: >-
|
||||
{{
|
||||
[
|
||||
_container_network_subnet | ansible.utils.ipsubnet(25, 0),
|
||||
_container_network_subnet | ansible.utils.ipsubnet(25, 1)
|
||||
] if network.ip | default('') | length > 0 else []
|
||||
}}
|
||||
_container_network_range: >-
|
||||
{{
|
||||
_container_network_subnet_ranges |
|
||||
reject('ansible.utils.supernet_of', network.ip) |
|
||||
first
|
||||
if network.ip | default('') | length > 0 else ''
|
||||
}}
|
||||
Reference in New Issue
Block a user