Skip to content

Docs: Added routing table example and Fixes #536#849

Open
Ajith177 wants to merge 2 commits intolinux-system-roles:mainfrom
Ajith177:docs/routing-table-example
Open

Docs: Added routing table example and Fixes #536#849
Ajith177 wants to merge 2 commits intolinux-system-roles:mainfrom
Ajith177:docs/routing-table-example

Conversation

@Ajith177
Copy link

@Ajith177 Ajith177 commented Mar 16, 2026

What this PR does

Closes #536

Two documentation improvements to the route and routing_rule sections
based on user confusion reported in the issue thread.

Change 1 — Named routing table creation example

The README already mentions that users must ensure named tables are defined
in /etc/iproute2/rt_tables or /etc/iproute2/rt_tables.d/*.conf before
using them, but gave no guidance on how to do this.

Added an ansible.builtin.lineinfile example showing how to create named
routing table entries alongside the network role — as suggested by @tyll in
the issue thread.

Change 2 — initscripts provider limitation note

Added a note in the Limitations section clarifying that routing_rule
and named table references in route are not supported when using the
initscripts provider.

This was explicitly requested by @alessard-trackforce who spent 4 hours
debugging this undocumented behavior.

Testing

Documentation-only change. No code was modified.
Verified the markdown renders correctly locally.

Summary by Sourcery

Clarify routing table usage and provider limitations in the networking role documentation.

Documentation:

  • Document that the network role does not create named routing table entries and show how to manage them with an ansible.builtin.lineinfile example.
  • Add a limitation note explaining that routing rules and named routing tables are not supported with the initscripts provider and will be ignored, recommending NetworkManager for routing rule support.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 16, 2026

Reviewer's Guide

Updates documentation to show how to create named routing tables alongside the network role and clarifies that routing rules and named routing tables are unsupported when using the initscripts provider.

Flow diagram for defining named routing tables before applying the network role

flowchart TD
  A["Start Ansible playbook"] --> B["Task: Ensure custom routing tables are defined"]
  B --> C["ansible.builtin.lineinfile updates /etc/iproute2/rt_tables"]
  C --> D["Custom table IDs and names exist in rt_tables"]
  D --> E["Task: Apply network role with routes using named tables"]
  E --> F["Routes reference existing named tables"]
  F --> G["End playbook"]
Loading

Flow diagram for routing_rule and named table behavior by provider

flowchart TD
  A["Configure network role with routing_rule and named table in route"] --> B{network_provider}
  B -->|"nm (NetworkManager)"| C["NetworkManager applies configuration"]
  C --> D["routing_rule entries processed"]
  C --> E["Named table references in route honored"]
  B -->|"initscripts"| F["initscripts applies base network configuration"]
  F --> G["routing_rule entries silently ignored"]
  F --> H["Named table references in route silently ignored"]
Loading

File-Level Changes

Change Details Files
Add concrete example for defining named routing tables before using them in routes and routing rules.
  • Extend existing explanation about named routing tables to state the network role does not create routing table entries automatically.
  • Add an Ansible playbook snippet using ansible.builtin.lineinfile to ensure custom routing tables are defined in /etc/iproute2/rt_tables before applying the network role.
  • Duplicate the same guidance/example in the routing_rule documentation block so both route and routing_rule sections show how to define named tables.
README.md
Document limitation of routing rules and named routing tables when using the initscripts provider.
  • Add a note in the Limitations section that routing rules and named routing tables are not supported when network_provider: initscripts is used.
  • Clarify that routing_rule entries and named table references in route will be silently ignored with the initscripts provider and recommend using network_provider: nm for routing rule support.
README.md

Assessment against linked issues

Issue Objective Addressed Explanation
#536 When network_provider: nm (NetworkManager) is selected, automatically install the NetworkManager-config-routing-rules package to enable routing-rules support. The PR only updates documentation and explicitly states that no code was modified. There is no change to install NetworkManager-config-routing-rules when the NetworkManager provider is used.
#536 Add support in the role to create routing table definitions in /etc/iproute2/rt_tables or /etc/iproute2/rt_tables.d/*.conf if they do not exist. The PR adds documentation and an example using ansible.builtin.lineinfile showing users how they can create routing table entries themselves, and explicitly states that the network role does not create these entries automatically. No code is added to the role to create or manage routing tables.
#536 Add routing rules and routing table support for the initscripts network provider. The PR updates the README to document that routing rules and named routing tables are not supported with the initscripts provider and will be silently ignored. It does not add or change any code to implement this support.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The sentence ending with /etc/iproute2/rt_tables.d/*.conf.The network role does not create...` is missing a space after the period; updating this will avoid a rendering/reading glitch.
  • You’ve duplicated the ansible.builtin.lineinfile example in both the route and routing_rule sections; consider extracting this into a single shared note or referencing one section from the other to reduce future drift between the two examples.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The sentence ending with `/etc/iproute2/rt_tables.d/*.conf`.The network role does not create...` is missing a space after the period; updating this will avoid a rendering/reading glitch.
- You’ve duplicated the `ansible.builtin.lineinfile` example in both the `route` and `routing_rule` sections; consider extracting this into a single shared note or referencing one section from the other to reduce future drift between the two examples.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

README.md Outdated
```yaml
- name: Ensure custom routing tables are defined
ansible.builtin.lineinfile:
path: /etc/iproute2/rt_tables

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the recommendation for the user should be to insert the conf file in

/etc/iproute2/rt_tables.d/{{ item.name }}.conf`

README.md Outdated
```yaml
- name: Ensure custom routing tables are defined
ansible.builtin.lineinfile:
path: /etc/iproute2/rt_tables

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here,

/etc/iproute2/rt_tables.d/{{ item.name }}.conf`

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rajeshrah22 I have Updated the examples to use -> /etc/iproute2/rt_tables.d/{{ item.name }}.conf` in both sections.

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.

Routing rules improvement

2 participants