Introduce 1450 MTU for Docker-encapsulated networking

This commit is contained in:
stack 2017-03-20 22:02:45 +00:00
parent 0096f42508
commit a5fe4b7702
5 changed files with 34 additions and 17 deletions

View File

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

View File

@ -0,0 +1,8 @@
---
- 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

@ -24,3 +24,16 @@
- include: storage.yml
when: "{{ 'Data loop file' in docker_info.stdout }}"
- name: Read Docker daemon config file
slurp:
src: /etc/docker/daemon.json
register: docker_daemon_conf
become: True
- name: Parse Docker daemon config JSON
set_fact:
docker_daemon_json: "{{ docker_daemon_conf['content'] | b64decode | from_json }}"
- include: config.yml
when: "{{ docker_daemon_json['mtu'] }} != 1450 or {{ docker_daemon_json['storage-driver'] }} != 'devicemapper'"

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": 1450,
"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"
]
}