Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a global config option for Docker network MTU #3502

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

davidmehren
Copy link
Contributor

When using this playbook in...annoying network environments, it may be required to set the MTU of Docker networks to a lower value than the default of 1500. Also annoyingly, it is not sufficient to set a default MTU using Docker daemon options, as that gets ignored when custom networks are created.

This PR introduces a new config option matrix_playbook_docker_network_mtu, that needs to get referenced every time a new Docker network is created. I currently do not know a simpler way to achieve this outcome, but I'm open to suggestions 😃

Please let me know if you'd like the option to be named differently.

spantaleev added a commit to devture/com.devture.ansible.role.systemd_docker_base that referenced this pull request Sep 18, 2024
@spantaleev spantaleev merged commit c89c356 into spantaleev:master Sep 18, 2024
2 checks passed
@spantaleev
Copy link
Owner

I've reworked this by:

  • adding a new devture_systemd_docker_base_container_networks_driver_options variable to the systemd_docker_base role (see 3cc7d1239654752da3e8f65760) - people can now use devture_systemd_docker_base_container_networks_driver_options_custom to define their own custom driver options
  • updating all roles used by the playbook (both in roles/custom/) to respect the devture_systemd_docker_base_container_networks_driver_options variable
  • updating various other roles pulled via Ansible Galaxy into roles/galaxy/ and making the playbook pull their new versions (via requirements.yml)

With this, you should be able to use this in your vars.yml configuration:

devture_systemd_docker_base_container_networks_driver_options_custom:
  com.docker.network.driver.mtu: 1234

.. and have container networks with a custom MTU of 1234 created/updated.

Adjusting devture_systemd_docker_base_container_networks_driver_options_custom subsequently is possible to a limited extent:

  • changing values to existing options or introducing new options is OK
  • removing options will not unset them. To unset, you either need to set to some benign value (e.g. 1500 for MTU) or to delete the networks (docker network rm $(docker network ls -q)) and have the playbook recreate them

@davidmehren
Copy link
Contributor Author

Thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants