Skip to content
Snippets Groups Projects
Commit db3d79fd authored by Anders Harrisson's avatar Anders Harrisson
Browse files

Add configuration for default bridge ip range

parent 2536141a
No related merge requests found
Pipeline #19772 passed with stage
in 5 minutes and 12 seconds
......@@ -32,6 +32,9 @@ docker_cron_task: true
# docker_default_address_pools:
# - base: 172.21.0.0/16
# size: 24
# Define the following variable to set the ip range used by Docker's default
# bridge network (docker0)
# docker_bip: 172.21.0.1/24
```
The users defined in the ``docker_users`` variable will be added to the docker group.
......
......@@ -14,3 +14,6 @@ docker_cron_task: true
# docker_default_address_pools:
# - base: 172.21.0.0/16
# size: 24
# Define the following variable to set the ip range used by Docker's default
# bridge network (docker0)
# docker_bip: 172.21.0.1/24
......@@ -19,6 +19,7 @@ provisioner:
docker_default_address_pools:
- base: 172.21.0.0/16
size: 24
docker_bip: 172.21.0.1/24
scenario:
name: default
verifier:
......
......@@ -52,10 +52,20 @@ def test_docker_storage_driver(host):
assert not config.contains('"storage-driver":')
def test_docker_default_address_pool(host):
def test_docker_bip(host):
with host.sudo():
cmd = host.run("docker network inspect --format '{{(index .IPAM.Config 0).Subnet}}' bridge")
if host.ansible.get_variables()["inventory_hostname"] == "ics-ans-role-docker-daemon-config":
assert cmd.stdout.strip() == "172.21.0.0/24"
assert cmd.stdout.strip() == "172.21.0.1/24"
else:
assert cmd.stdout.strip() == "172.17.0.0/16"
def test_docker_default_address_pool(host):
with host.sudo():
host.run('docker network create custom-network')
cmd = host.run("docker network inspect --format '{{(index .IPAM.Config 0).Subnet}}' custom-network")
if host.ansible.get_variables()["inventory_hostname"] == "ics-ans-role-docker-daemon-config":
assert cmd.stdout.strip() == "172.21.1.0/24"
else:
assert cmd.stdout.strip() == "172.18.0.0/16"
......@@ -2,10 +2,12 @@
{% if docker_default_address_pools is defined %}
"default-address-pools": {{ docker_default_address_pools | to_json }},
{% endif %}
{% if docker_bip is defined %}
"bip": "{{ docker_bip }}",
{% endif %}
{% if docker_storage_driver is defined %}
"storage-driver": "{{ docker_storage_driver }}",
{% endif %}
"log-driver": "{{ docker_log_driver }}",
"log-opts": {{ docker_log_opts | to_json }}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment