From: David Galloway Date: Thu, 24 Mar 2022 19:14:26 +0000 (-0400) Subject: common: Refactor MTU setting X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=281d71332a85365f4b4a277bded33d54a09a7ea4;p=ceph-cm-ansible.git common: Refactor MTU setting This allows us to define an 'mtu' per machine type in group_vars. Signed-off-by: David Galloway --- diff --git a/roles/common/tasks/secondary_nic.yml b/roles/common/tasks/secondary_nic.yml index 557201b..afd1cbb 100644 --- a/roles/common/tasks/secondary_nic.yml +++ b/roles/common/tasks/secondary_nic.yml @@ -27,9 +27,6 @@ with_items: "{{ ethtool_grep_output.results }}" when: item.rc == 0 -# Default to 1500 -- set_fact: mtu=1500 - - name: "Check if {{ nic_to_configure }} is 10Gb" shell: "ethtool {{ nic_to_configure }} | grep Speed | awk '{ print $2 }'" register: nic_to_configure_speed @@ -39,6 +36,7 @@ - name: Set MTU to 9000 if 10Gb set_fact: mtu=9000 when: + - mtu is not defined - nic_to_configure_speed is defined - (nic_to_configure_speed.stdout == '10000Mb/s' or nic_to_configure_speed.stdout == '25000Mb/s') @@ -55,7 +53,7 @@ # Can't set MTU for DHCP interfaces on Ubuntu in /etc/network/interfaces - name: Set MTU on Ubuntu - shell: "ifconfig {{ nic_to_configure }} mtu {{ mtu }}" + shell: "ifconfig {{ nic_to_configure }} mtu {{ mtu|default('1500') }}" when: ansible_os_family == 'Debian' - name: "Bounce {{ nic_to_configure }}" @@ -78,7 +76,7 @@ - { regexp: '^DEVICE=', line: 'DEVICE={{ nic_to_configure }}' } - { regexp: '^BOOTPROTO=', line: 'BOOTPROTO=dhcp' } - { regexp: '^ONBOOT=', line: 'ONBOOT=yes' } - - { regexp: '^MTU=', line: 'MTU={{ mtu }}' } + - { regexp: '^MTU=', line: 'MTU={{ mtu|default("1500") }}' } when: - nic_to_configure is defined - ansible_os_family == 'RedHat'