Merge pull request #3 from oneswig/docker-mtu

Introduce configurable MTU for Docker-encapsulated networking
This commit is contained in:
Mark Goddard 2017-03-22 12:13:15 +00:00 committed by GitHub
commit fce4df3143
7 changed files with 32 additions and 17 deletions

View File

@ -3,3 +3,4 @@
hosts: docker
roles:
- role: docker
docker_daemon_mtu: "{{ external_net_name | net_mtu }}"

View File

@ -20,3 +20,6 @@ docker_storage_thinpool_autoextend_threshold: 80
# Percentage by which to extend thin-provisioned docker storage volumes.
docker_storage_thinpool_autoextend_percent: 20
# MTU to pass through to containers not using net=host
docker_daemon_mtu: 1500

View File

@ -0,0 +1,6 @@
---
- name: restart docker service
service:
name: docker
state: restarted
become: True

View File

@ -0,0 +1,7 @@
---
- name: Ensure the docker daemon configuration file exists
template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
become: True
notify: restart docker service

View File

@ -6,6 +6,12 @@
append: yes
become: True
- name: Ensure Docker daemon is started
service:
name: docker
state: started
become: True
- name: Check whether docker storage is in loopback mode
command: docker info
register: docker_info
@ -24,3 +30,5 @@
- include: storage.yml
when: "{{ 'Data loop file' in docker_info.stdout }}"
- include: config.yml

View File

@ -4,6 +4,7 @@
name: docker
state: stopped
become: True
notify: restart docker service
- name: Ensure loopback storage state is absent
file:
@ -47,15 +48,3 @@
lvchange --metadataprofile docker-thinpool
{{ docker_storage_volume_group }}/{{ docker_storage_volume_thinpool }}
become: True
- name: Ensure the docker daemon configuration file exists
template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
become: True
- name: Ensure the docker daemon is running
service:
name: docker
state: started
become: True

View File

@ -1,8 +1,9 @@
{
"storage-driver": "devicemapper",
"storage-opts": [
"dm.thinpooldev=/dev/mapper/{{ docker_storage_volume_group | replace('-', '--') }}-{{ docker_storage_volume_thinpool | replace('-', '--') }}",
"dm.use_deferred_removal=true",
"dm.use_deferred_deletion=true"
]
"mtu": {{ docker_daemon_mtu }},
"storage-opts": [
"dm.thinpooldev=/dev/mapper/{{ docker_storage_volume_group | replace('-', '--') }}-{{ docker_storage_volume_thinpool | replace('-', '--') }}",
"dm.use_deferred_removal=true",
"dm.use_deferred_deletion=true"
]
}