Anton on Nostr: Fun with Ansible. `defaults/main.yml`: docker_mtu: "{{ ansible_default_ipv6.mtu | ...
Fun with Ansible.
`defaults/main.yml`:
docker_mtu: "{{ ansible_default_ipv6.mtu | default(1450) | int }}"
To use this variable in another default variable, it always ends up as a string. Which the docker daemon does not really like.
Result? Let python/jinja2 handle it in the template:
{{ dict(docker_daemon_config, **{"mtu": docker_mtu|int }) | to_nice_json }}
Does someone have a better solution so the MTU is actually written out as an integer?
#ansible #jinja2 #python
`defaults/main.yml`:
docker_mtu: "{{ ansible_default_ipv6.mtu | default(1450) | int }}"
To use this variable in another default variable, it always ends up as a string. Which the docker daemon does not really like.
Result? Let python/jinja2 handle it in the template:
{{ dict(docker_daemon_config, **{"mtu": docker_mtu|int }) | to_nice_json }}
Does someone have a better solution so the MTU is actually written out as an integer?
#ansible #jinja2 #python