From 09ae963f5859b1c4adfb58d269ea132b8ae509ea Mon Sep 17 00:00:00 2001 From: "Alistair MacCallum [Vaarst]" <81685753+AlistairMaccallum@users.noreply.github.com> Date: Wed, 25 Oct 2023 07:45:45 +0100 Subject: [PATCH] nmcli: add additional documentation for routing_rules4 option (#7403) * Add additional documentation for routing_rules4 option. I had some trouble initially getting this to work as I wasn't very clear on what was required to that end I have added an example task and fixed what I suspect is a typo in the description. * Update nmcli.py Remove trailing whitespace. --- plugins/modules/nmcli.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/modules/nmcli.py b/plugins/modules/nmcli.py index 9f8d6ede1d..f5e536f02d 100644 --- a/plugins/modules/nmcli.py +++ b/plugins/modules/nmcli.py @@ -169,7 +169,7 @@ options: version_added: 2.0.0 routing_rules4: description: - - Is the same as in an C(ip route add) command, except always requires specifying a priority. + - Is the same as in an C(ip rule add) command, except always requires specifying a priority. type: list elements: str version_added: 3.3.0 @@ -1489,6 +1489,22 @@ EXAMPLES = r''' vlandev: eth0 vlanid: 5 state: present + +## Defining ip rules while setting a static IP +## table 'production' is set with id 200 in this example. +- name: Set Static ips for interface with ip rules and routes + community.general.nmcli: + type: ethernet + conn_name: 'eth0' + ip4: '192.168.1.50' + gw4: '192.168.1.1' + state: present + routes4_extended: + - ip: "0.0.0.0/0" + next_hop: "192.168.1.1" + table: "production" + routing_rules4: + - "priority 0 from 192.168.1.50 table 200" ''' RETURN = r"""#