container: Set network ip range when using a static container ip

This commit is contained in:
uumas
2025-09-15 12:32:22 +03:00
parent a93c26864d
commit d3542993dd
2 changed files with 18 additions and 5 deletions

View File

@@ -11,6 +11,22 @@ _container_networks_with_ip: >-
]
+ _container_networks[1:]
}}
_container_network_subnet: >-
{{ container_ip | ansible.utils.ipsubnet(24) if container_ip | length > 0 else '' }}
_container_network_subnet_ranges: >-
{{
[
_container_network_subnet | ansible.utils.ipsubnet(25, 0),
_container_network_subnet | ansible.utils.ipsubnet(25, 1)
] if container_ip | length > 0 else ''
}}
_container_network_range: >-
{{
_container_network_subnet_ranges |
reject('ansible.utils.supernet_of', container_ip) |
first
if container_ip | length > 0 else ''
}}
_container_volumes: "{{ container_mounts | selectattr('type', '==', 'volume') }}"