Commit 9a3dcf59 by Matjaz Gregoric

Use built-in ansible_default_ipv4 variable.

It turns out ansible already provides info about the default network
interface in the ansible_default_ipv4 dict variable, so we can use that
instead of using the 'ip route show' command.
parent 1b376669
......@@ -30,13 +30,8 @@
tags:
- deploy
- name: Get name of default network interface
shell: "ip route show 0/0 | grep -oP '(?<=dev )[[:alnum:]]+'"
register: get_interface_name
when: ansible_distribution in common_debian_variants
- name: Set the MTU to 1500 temporarily
shell: "/sbin/ifconfig {{ get_interface_name.stdout }} mtu 1500 up"
shell: "/sbin/ifconfig {{ ansible_default_ipv4.interface }} mtu 1500 up"
when: ansible_distribution in common_debian_variants
- name: Set the MTU to 1500 permanently
......
#!/bin/sh
ifconfig {{ get_interface_name.stdout }} mtu 1500
ifconfig {{ ansible_default_ipv4.interface }} mtu 1500
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment