From cf5db1d59c5d754bad6441f39c90d46a2975e7bf Mon Sep 17 00:00:00 2001 From: stack Date: Wed, 22 Mar 2017 09:30:59 +0000 Subject: [PATCH] Second pass at Docker MTU assignment --- ansible/roles/docker/tasks/config.yml | 1 - ansible/roles/docker/tasks/main.yml | 17 ++++++----------- ansible/roles/docker/templates/daemon.json.j2 | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ansible/roles/docker/tasks/config.yml b/ansible/roles/docker/tasks/config.yml index 8284ccfc0..af3704bda 100644 --- a/ansible/roles/docker/tasks/config.yml +++ b/ansible/roles/docker/tasks/config.yml @@ -5,4 +5,3 @@ dest: /etc/docker/daemon.json become: True notify: restart docker service - diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index d3d578b74..b44cb6d4e 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -6,6 +6,12 @@ append: yes become: True +- name: Check Docker state with systemd + service: + name: docker + state: started + become: True + - name: Check whether docker storage is in loopback mode command: docker info register: docker_info @@ -25,15 +31,4 @@ - 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'" diff --git a/ansible/roles/docker/templates/daemon.json.j2 b/ansible/roles/docker/templates/daemon.json.j2 index 0da43abc7..67eab7a81 100644 --- a/ansible/roles/docker/templates/daemon.json.j2 +++ b/ansible/roles/docker/templates/daemon.json.j2 @@ -1,6 +1,6 @@ { "storage-driver": "devicemapper", - "mtu": 1450, + "mtu": {{ external_net_name | net_mtu }}, "storage-opts": [ "dm.thinpooldev=/dev/mapper/{{ docker_storage_volume_group | replace('-', '--') }}-{{ docker_storage_volume_thinpool | replace('-', '--') }}", "dm.use_deferred_removal=true",