Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-112804

[Epic]: Ansible RHEL network system role fails cannot find route table main

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • [Epic]: Ansible RHEL network system role fails cannot find route table main
    • Important
    • Red Hat Enterprise Linux
    • 50% To Do, 25% In Progress, 25% Done
    • rhel-system-roles
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Dev ack
    • Bug Fix
    • Hide
      Cause:
      Consequence:
      Fix:
      Result:
      Show
      Cause: Consequence: Fix: Result:
    • Proposed
    • Unspecified
    • Unspecified
    • Unspecified

      What were you trying to do that didn't work?

      Ansible fails in RHEL 9.6 using network role `rhel-system-roles-1.95.7-0.1.el9_6.noarch` if static routes are defined in table `main`.
      Ansible roles fails to find `/etc/iproute2/rt_tables` and exists with an error.

      [WARNING]: [001] <error> #0, state:up persistent_state:present, 'ens3': connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`
      fatal: [localhost]: FAILED! => \{"_invocation": {"module_args": {"__debug_flags": "", "__header": "#\n# Ansible managed\n#\n# system_role:network\n", "connections": [{"autoconnect": true, "interface_name": "ens3", "ip": {"dhcp4": true, "route": [{"gateway": "192.0.100.1", "network": "192.0.100.128", "prefix": 26, "table": "main"}]}, "name": "ens3", "state": "up", "type": "ethernet"}], "force_state_change": false, "ignore_errors": false, "provider": "nm"}}, "changed": false, "msg": "error: connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`", "stderr": "[001] <error> #0, state:up persistent_state:present, 'ens3': connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`\n", "stderr_lines": ["[001] <error> #0, state:up persistent_state:present, 'ens3': connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`"]}
      
      
      PLAY RECAP *************************************************************************************************************************************************************************************************************************
      localhost : ok=8 changed=0 unreachable=0 failed=1 skipped=14 rescued=0 ignored=0
      

      Apparently rt_tables have been moved under /usr/share/iproute2 in RHEL 9.6, as documented in https://access.redhat.com/solutions/7123966. Ansible roles still looks for the file from wrong place.

      What is the impact of this issue to you?
      Breaks installation and deploying

      Please provide the package NVR for which the bug is seen:

      # rpm -qa | grep rhel
      rhel-system-roles-1.95.7-0.1.el9_6.noarch
      # cat /etc/redhat-release
      Red Hat Enterprise Linux release 9.6 (Plow)
      

      How reproducible is this bug?:
      Always

      Steps to reproduce:

      ---
      - name: Test 04232703
        hosts: localhost
        tasks:
          - name: Configure connection profile and specify the table in static routes
            import_role:
              name: rhel-system-roles.network
            vars:
              network_connections:
                - name: ens3
                  interface_name: ens3
                  type: ethernet
                  state: up
                  autoconnect: true
                  ip:
                    dhcp4: true
                    route:
                      - network: 192.0.100.128
                        prefix: 26
                        gateway: 192.0.100.1
                        table: main
      ...
      
      
      

      Expected results
      No error and route correctly configured in the table main

      Actual results

      # ansible-playbook playbook.yml --ask-become-pass
      BECOME password:
      [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
      
      
      PLAY [Test 04232703] ***************************************************************************************************************************************************************************************************************
      
      
      TASK [Gathering Facts] *************************************************************************************************************************************************************************************************************
      ok: [localhost]
      
      
      TASK [rhel-system-roles.network : Ensure ansible_facts used by role] ***************************************************************************************************************************************************************
      included: /usr/share/ansible/roles/rhel-system-roles.network/tasks/set_facts.yml for localhost
      
      
      [... omitted for brevity ...]
      
      
      TASK [rhel-system-roles.network : Configure networking connection profiles] ********************************************************************************************************************************************************
      [WARNING]: [001] <error> #0, state:up persistent_state:present, 'ens3': connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`
      fatal: [localhost]: FAILED! => \{"_invocation": {"module_args": {"__debug_flags": "", "__header": "#\n# Ansible managed\n#\n# system_role:network\n", "connections": [{"autoconnect": true, "interface_name": "ens3", "ip": {"dhcp4": true, "route": [{"gateway": "192.0.100.1", "network": "192.0.100.128", "prefix": 26, "table": "main"}]}, "name": "ens3", "state": "up", "type": "ethernet"}], "force_state_change": false, "ignore_errors": false, "provider": "nm"}}, "changed": false, "msg": "error: connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`", "stderr": "[001] <error> #0, state:up persistent_state:present, 'ens3': connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`\n", "stderr_lines": ["[001] <error> #0, state:up persistent_state:present, 'ens3': connection[0]: cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`"]}
      
      
      PLAY RECAP *************************************************************************************************************************************************************************************************************************
      localhost : ok=8 changed=0 unreachable=0 failed=1 skipped=14 rescued=0 ignored=0
      

      Workaround:
      Using the table number the issue is resolved

      ---
      - name: Test 04232703
      hosts: localhost
      tasks:
      
      - name: Configure connection profile and specify the table in static routes
      import_role:
      name: rhel-system-roles.network
      vars:
      network_connections:
      - name: ens3
      interface_name: ens3
      type: ethernet
      state: up
      autoconnect: true
      ip:
      dhcp4: true
      route:
      - network: 192.0.100.128
      prefix: 26
      gateway: 192.0.100.1
      table: 254
      ...
      
      
      # ansible-playbook playbook.yml --ask-become-pass
      BECOME password:
      [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
      
      
      PLAY [Test 04232703] ***************************************************************************************************************************************************************************************************************
      
      
      TASK [Gathering Facts] *************************************************************************************************************************************************************************************************************
      ok: [localhost]
      
      
      [...omitted for brevity...]
      
      
      
      TASK [rhel-system-roles.network : Show stderr messages for the network_connections] ************************************************************************************************************************************************
      ok: [localhost] => {
      "__network_connections_result.stderr_lines": [
      "[003] <info> #0, state:up persistent_state:present, 'ens3': update connection ens3, 1c64f036-5e58-383d-b94c-edaa41051dfb",
      "[004] <info> #0, state:up persistent_state:present, 'ens3': up connection ens3, 1c64f036-5e58-383d-b94c-edaa41051dfb (is-modified)",
      "[005] <info> #0, state:up persistent_state:present, 'ens3': connection reapplied"
      ]
      }
      
      
      TASK [rhel-system-roles.network : Show debug messages for the network_connections] *************************************************************************************************************************************************
      skipping: [localhost]
      
      
      TASK [rhel-system-roles.network : Show debug messages for the network_state] *******************************************************************************************************************************************************
      skipping: [localhost]
      
      
      TASK [rhel-system-roles.network : Re-test connectivity] ****************************************************************************************************************************************************************************
      ok: [localhost]
      
      
      PLAY RECAP *************************************************************************************************************************************************************************************************************************
      localhost : ok=11 changed=1 unreachable=0 failed=0 skipped=17 rescued=0 ignored=0
      
      
      # cat /etc/NetworkManager/system-connections/ens3.nmconnection | grep route
      route1=192.0.100.128/26,192.0.100.1
      route1_options=table=254
      

      Another workaround is to a symlink from `/etc/iproute2` to `/usr/share/iproute2` and this seems to allow plugin succeed.

      manu

              rmeggins@redhat.com Richard Megginson
              rmeggins@redhat.com Richard Megginson
              Richard Megginson Richard Megginson
              David Jez David Jez
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: