zuul-jobs/roles/ensure-docker/tasks/docker-setup.yaml
Ian Wienand 664d068ef7 ensure-docker: < 1500 MTU workaround
As described inline, we should lower the MTU in the docker
configuration when we see the interface has a MTU lower than 1500 so
things "just work".  This particularly affects the Linaro ARM64 cloud
in OpenDev, but it is a generic issue.

Change-Id: I338616c41a65b007d56648fdab6da2a6a6b909f4
Story: https://storyboard.openstack.org/#!/story/2008230
2020-10-06 11:26:15 +00:00

49 lines
1.3 KiB
YAML

---
- name: Ensure "docker" group exists
group:
name: "{{ docker_group }}"
state: present
- name: Add user to docker group
user:
name: "{{ ansible_user }}"
groups:
- "{{ docker_group }}"
append: yes
- name: Update docker daemon proxy configuration
when: docker_userland_proxy is defined
include_role:
name: update-json-file
vars:
update_json_file_name: /etc/docker/daemon.json
update_json_file_combine:
userland-proxy: "{{ docker_userland_proxy }}"
update_json_file_become: true
# Docker defaults to a MTU of 1500, which causes problems when the
# main interface has a MTU less than that. Cloud environments often
# have this, one good example is OpenDev's Linaro ARM64 cloud.
# https://storyboard.openstack.org/#!/story/2008230
- name: Lower default MTU
when: ansible_default_ipv4.mtu < 1500
include_role:
name: update-json-file
vars:
update_json_file_name: /etc/docker/daemon.json
update_json_file_combine:
mtu: 1400
update_json_file_become: true
- name: Restart docker
when: >-
(docker_userland_proxy is defined) or
(ansible_default_ipv4.mtu < 1500)
service:
name: docker
state: restarted
- name: Reset ssh connection to pick up docker group
meta: reset_connection