ios_config: match confusion

670 views
Skip to first unread message

Adam Wilkins

unread,
Feb 15, 2017, 7:19:07 AM2/15/17
to Ansible Project
I'm a little confused on the various match clauses in the 'ios_config' module. I understand IOS very well. I'm trying to find use cases for the different options here.

Does anyone have any example of when each would be used?


Here are the options:

    • line
    • strict
    • exact
    • none


Here is the definition:

Instructs the module on the way to perform the matching of the set of commands against the current device config. If match is set to line, commands are matched line by line. If match is set to strict, command lines are matched with respect to position. If match is set to exact, command lines must be an equal match. Finally, if match is set to none, the module will not attempt to compare the source configuration with the running configuration on the remote device.

Peter Sprygada

unread,
Feb 15, 2017, 9:05:02 PM2/15/17
to ansible...@googlegroups.com
match=line

* Simple line matching against the running config with respect to context (parents).  If the line is in the config, then nothing will be done.  If the line isn't in the config, it will be added

match=none

* Ignore the running config all together and push the config lines into the device running config

match=strict

* Strict line matching, for instance an ACL.  Ensures the statements are ordered as per the module definition

* Example

running-config:
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4
permit 5.5.5.5

module - passes
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4

module - fails (although match=line would pass)
permit 10 1.1.1.1
permit 20 4.4.4.4
permit 30 2.2.2.2
permit 40 3.3.3.3

match=exact 

* Strict line matching with absolute entries, again most common with ACL

* Example

running-config:
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4
permit 5.5.5.5

module - passes
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4
permit 5.5.5.5

module - fails (config has 5 total items, module definition expects only 4)
permit 10 1.1.1.1
permit 20 2.2.2.2
permit 30 2.2.2.2
permit 40 4.4.4.4

HTH



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1035eb9c-3e0f-4009-bd9d-cb74acc6c915%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages