Debian Codegraph @

ansible_collections/cisco/ios/plugins/modules/ios_ospfv2.py

raw
1 #!/usr/bin/python
2 #
3 # -*- coding: utf-8 -*-
4 # Copyright 2020 Red Hat
5 # GNU General Public License v3.0+
6 # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
7
8 #############################################
9 # WARNING #
10 #############################################
11 #
12 # This file is auto generated by the resource
13 # module builder playbook.
14 #
15 # Do not edit this file manually.
16 #
17 # Changes to this file will be over written
18 # by the resource module builder.
19 #
20 # Changes should be made in the model used to
21 # generate this file or in the resource module
22 # builder template.
23 #
24 #############################################
25
26 """
27 The module file for ios_ospfv2
28 """
29
30 from __future__ import absolute_import, division, print_function
31
32
33 __metaclass__ = type
34
35
36 DOCUMENTATION = """
37 module: ios_ospfv2
38 short_description: Resource module to configure OSPFv2.
39 description:
40 This module configures and manages the Open Shortest Path First (OSPF)
41 version 2 on IOS platforms.
42 version_added: 1.0.0
43 author:
44 - Sumit Jaiswal (@justjais)
45 - Vinay M (@roverflow)
46 notes:
47 - Tested against Cisco IOSXE Version 17.3 on CML.
48 - This module works with connection C(network_cli).
49 See U(https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html)
50 options:
51 config:
52 description: A dictionary of OSPF options.
53 type: dict
54 suboptions:
55 processes:
56 description:
57 - List of OSPF instance configurations.
58 type: list
59 elements: dict
60 suboptions:
61 process_id:
62 description: Process ID
63 required: true
64 type: int
65 vrf:
66 description: Specify parameters for a VPN Routing/Forwarding instance
67 type: str
68 address_family:
69 description: Router Address Family configuration mode
70 type: dict
71 suboptions:
72 default:
73 description: Set a command to its defaults
74 type: bool
75 snmp_context:
76 description:
77 - Modify snmp parameters
78 - Configure SNMP context name
79 type: str
80 topology:
81 description: Associate the routing protocol to a topology instance
82 type: dict
83 suboptions:
84 name:
85 description: Routing topology instance name
86 type: str
87 base:
88 description: Entering router topology sub mode
89 type: bool
90 tid:
91 description:
92 - Configuring the routing protocol topology tid
93 - Note, please refer vendor documentation for valid values
94 type: bool
95 adjacency:
96 description: To configure control adjacency formation
97 type: dict
98 suboptions:
99 min_adjacency:
100 description:
101 - Initial number of adjacencies allowed to be forming in an area
102 - Please refer vendor documentation for valid values
103 type: int
104 max_adjacency:
105 description:
106 - Maximum number of adjacencies allowed to be forming
107 - Please refer vendor documentation for valid values
108 type: int
109 none:
110 description: No initial
111 type: bool
112 areas:
113 description: OSPF area parameters
114 type: list
115 elements: dict
116 suboptions:
117 area_id:
118 description:
119 - OSPF area ID as a decimal value. Please refer vendor documentation
120 of Valid values.
121 - OSPF area ID in IP address format(e.g. A.B.C.D)
122 type: str
123 authentication:
124 description: Area authentication
125 type: dict
126 suboptions:
127 enable:
128 description: Enable area authentication
129 type: bool
130 message_digest:
131 description: Use IPsec authentication
132 type: bool
133 capability:
134 description:
135 - Enable area specific capability
136 - Enable exclusion of links from base topology
137 type: bool
138 default_cost:
139 description:
140 - Set the summary default-cost of a NSSA/stub area
141 - Stub's advertised external route metric
142 - Note, please refer vendor documentation for respective valid values
143 type: int
144 filter_list:
145 description: Filter networks between OSPF areas
146 type: list
147 elements: dict
148 suboptions:
149 name:
150 description: Name of an IP prefix-list
151 type: str
152 direction:
153 description: The direction to apply on the filter networks sent to and from this area.
154 type: str
155 choices: ["in", "out"]
156 required: true
157 nssa:
158 description: Specify a NSSA area
159 type: dict
160 suboptions:
161 set:
162 description: Enable a NSSA area
163 type: bool
164 default_information_originate:
165 description: Originate Type 7 default into NSSA area
166 type: dict
167 suboptions:
168 metric:
169 description: OSPF default metric
170 type: int
171 metric_type:
172 description:
173 - OSPF metric type for default routes
174 - OSPF Link State type
175 type: int
176 choices: [1, 2]
177 nssa_only:
178 description: Limit default advertisement to this NSSA area
179 type: bool
180 no_ext_capability:
181 description: Do not send domain specific capabilities into NSSA
182 type: bool
183 no_redistribution:
184 description: No redistribution into this NSSA area
185 type: bool
186 no_summary:
187 description: Do not send summary LSA into NSSA
188 type: bool
189 translate:
190 description:
191 - Translate LSA
192 - Always translate LSAs on this ABR
193 - Suppress forwarding address in translated LSAs
194 type: str
195 choices: ["always", "suppress-fa"]
196 ranges:
197 description: Summarize routes matching address/mask (border routers only)
198 type: list
199 elements: dict
200 suboptions:
201 address:
202 description: IP address to match
203 type: str
204 netmask:
205 description: IP mask for address
206 type: str
207 advertise:
208 description:
209 - Advertise this range (default)
210 - Since, advertise when enabled is not shown in running-config
211 idempotency won't be maintained for the play in the second or
212 next run of the play.
213 type: bool
214 cost:
215 description: User specified metric for this range
216 type: int
217 not_advertise:
218 description: DoNotAdvertise this range
219 type: bool
220 sham_link:
221 description: Define a sham link and its parameters
222 type: dict
223 suboptions:
224 source:
225 description: IP addr associated with sham-link source (A.B.C.D)
226 type: str
227 destination:
228 description: IP addr associated with sham-link destination (A.B.C.D)
229 type: str
230 cost:
231 description:
232 - Associate a cost with the sham-link
233 - Cost of the sham-link
234 - Note, please refer vendor documentation for respective valid values
235 type: int
236 ttl_security:
237 description:
238 - TTL security check
239 - Maximum number of IP hops allowed
240 type: int
241 stub:
242 description:
243 - Specify a stub area
244 - Backbone can not be configured as stub area
245 type: dict
246 suboptions:
247 set:
248 description: Enable a stub area
249 type: bool
250 no_ext_capability:
251 description: Do not send domain specific capabilities into stub area
252 type: bool
253 no_summary:
254 description: Do not send summary LSA into stub area
255 type: bool
256 auto_cost:
257 description: Calculate OSPF interface cost according to bandwidth
258 type: dict
259 suboptions:
260 set:
261 description: Enable OSPF auto-cost
262 type: bool
263 reference_bandwidth:
264 description:
265 - Use reference bandwidth method to assign OSPF cost
266 - Note, refer vendor documentation for respective valid values
267 type: int
268 bfd:
269 description:
270 - BFD configuration commands
271 - Enable BFD on all interfaces
272 type: bool
273 capability:
274 description: Enable specific OSPF feature
275 type: dict
276 suboptions:
277 lls:
278 description: Link-local Signaling (LLS) support
279 type: bool
280 opaque:
281 description: Opaque LSA
282 type: bool
283 transit:
284 description: Transit Area
285 type: bool
286 vrf_lite:
287 description: Do not perform PE specific checks
288 type: bool
289 compatible:
290 description: OSPF router compatibility list
291 type: dict
292 suboptions:
293 rfc1583:
294 description: compatible with RFC 1583
295 type: bool
296 rfc1587:
297 description: compatible with RFC 1587
298 type: bool
299 rfc5243:
300 description: supports DBD exchange optimization
301 type: bool
302 default_information:
303 description: Control distribution of default information
304 type: dict
305 suboptions:
306 originate:
307 description: Distribute a default route
308 type: bool
309 always:
310 description: Always advertise default route
311 type: bool
312 metric:
313 description:
314 - OSPF default metric
315 - Note, refer vendor documentation for respective valid values
316 type: int
317 metric_type:
318 description:
319 - OSPF metric type for default routes
320 - Note, please refer vendor documentation for respective valid range
321 type: int
322 route_map:
323 description: Route-map reference name
324 type: str
325 default_metric:
326 description: Set metric of redistributed routes
327 type: int
328 discard_route:
329 description: Enable or disable discard-route installation
330 type: dict
331 suboptions:
332 set:
333 description: Enable discard-route installation
334 type: bool
335 external:
336 description:
337 - Discard route for redistributed summarised routes
338 - Administrative distance for redistributed summarised routes
339 - Note, please refer vendor documentation for respective valid range
340 type: int
341 internal:
342 description:
343 - Discard route for summarised internal routes
344 - Administrative distance for summarised internal routes
345 - Note, please refer vendor documentation for respective valid range
346 type: int
347 distance:
348 description: Define an administrative distance
349 type: dict
350 suboptions:
351 admin_distance:
352 description: OSPF Administrative distance
353 type: dict
354 suboptions:
355 distance:
356 description: Administrative distance
357 type: int
358 address:
359 description: IP Source address
360 type: str
361 wildcard_bits:
362 description: Wildcard bits
363 type: str
364 acl:
365 description: Access-list name/number
366 type: str
367 ospf:
368 description: OSPF distance
369 type: dict
370 suboptions:
371 external:
372 description: External type 5 and type 7 routes
373 type: int
374 inter_area:
375 description: Inter-area routes
376 type: int
377 intra_area:
378 description: Intra-area routes
379 type: int
380 distribute_list:
381 description: Filter networks in routing updates
382 type: dict
383 suboptions:
384 acls:
385 description: IP access list
386 type: list
387 elements: dict
388 suboptions:
389 name:
390 description: IP access list name/number
391 type: str
392 required: true
393 direction:
394 description: Filter incoming and outgoing routing updates.
395 type: str
396 required: true
397 choices: ["in", "out"]
398 interface:
399 description:
400 - Interface configuration (GigabitEthernet A/B)
401 - Valid with incoming traffic
402 type: str
403 protocol:
404 description:
405 - Protocol config (bgp 1).
406 - Valid with outgoing traffic
407 type: str
408 prefix:
409 description: Filter prefixes in routing updates
410 type: dict
411 suboptions:
412 name:
413 description: Name of an IP prefix-list
414 type: str
415 required: true
416 gateway_name:
417 description: Gateway name for filtering incoming updates based on gateway
418 type: str
419 direction:
420 description: Filter incoming and outgoing routing updates.
421 type: str
422 required: true
423 choices: ["in", "out"]
424 interface:
425 description:
426 - Interface configuration (GigabitEthernet A/B)
427 - Valid with incoming traffic
428 type: str
429 protocol:
430 description:
431 - Protocol config (bgp 1).
432 - Valid with outgoing traffic
433 type: str
434 route_map:
435 description: Filter prefixes in routing updates
436 type: dict
437 suboptions:
438 name:
439 description: Route-map name
440 type: str
441 required: true
442 domain_id:
443 description: OSPF domain-id
444 type: dict
445 suboptions:
446 ip_address:
447 description: IP address
448 type: dict
449 suboptions:
450 address:
451 description: OSPF domain ID in IP address format
452 type: str
453 secondary:
454 description: Secondary Domain-ID
455 type: bool
456 "null":
457 description: Null Domain-ID
458 type: bool
459 domain_tag:
460 description:
461 - OSPF domain-tag which is OSPF domain tag - 32-bit value
462 - Note, please refer vendor documentation for respective valid range
463 type: int
464 event_log:
465 description: Event Logging
466 type: dict
467 suboptions:
468 enable:
469 description: Enable event Logging
470 type: bool
471 one_shot:
472 description: Disable Logging When Log Buffer Becomes Full
473 type: bool
474 pause:
475 description: Pause Event Logging
476 type: bool
477 size:
478 description:
479 - Maximum Number of Events Stored in the Event Log
480 - Note, refer vendor documentation for respective valid values
481 type: int
482 help:
483 description: Description of the interactive help system
484 type: bool
485 ignore:
486 description:
487 - Do not complain about specific event
488 - Do not complain upon receiving LSA of the specified type, MOSPF Type 6 LSA
489 type: bool
490 interface_id:
491 description:
492 - Source of the interface ID
493 - SNMP MIB ifIndex
494 type: bool
495 ispf:
496 description: Enable incremental SPF computation
497 type: bool
498 limit:
499 description: Limit a specific OSPF feature and LS update, DBD, and LS request retransmissions
500 type: dict
501 suboptions:
502 dc:
503 description: Demand circuit retransmissions
504 type: dict
505 suboptions:
506 number:
507 description: The maximum number of retransmissions
508 type: int
509 disable:
510 description: Disble the feature
511 type: bool
512 non_dc:
513 description: Non-demand-circuit retransmissions
514 type: dict
515 suboptions:
516 number:
517 description: The maximum number of retransmissions
518 type: int
519 disable:
520 description: Disble the feature
521 type: bool
522 local_rib_criteria:
523 description: Enable or disable usage of local RIB as route criteria
524 type: dict
525 suboptions:
526 enable:
527 description: Enable usage of local RIB as route criteria
528 type: bool
529 forwarding_address:
530 description: Local RIB used to validate external/NSSA forwarding addresses
531 type: bool
532 inter_area_summary:
533 description: Local RIB used as criteria for inter-area summaries
534 type: bool
535 nssa_translation:
536 description: Local RIB used as criteria for NSSA translation
537 type: bool
538 log_adjacency_changes:
539 description: Log changes in adjacency state
540 type: dict
541 suboptions:
542 set:
543 description: Log changes in adjacency state
544 type: bool
545 detail:
546 description: Log all state changes
547 type: bool
548 max_lsa:
549 description: Maximum number of non self-generated LSAs to accept
550 type: dict
551 suboptions:
552 number:
553 description:
554 - Maximum number of non self-generated LSAs to accept
555 - Note, refer vendor documentation for respective valid values
556 type: int
557 threshold_value:
558 description:
559 - Threshold value (%) at which to generate a warning msg
560 - Note, refer vendor documentation for respective valid values
561 type: int
562 ignore_count:
563 description:
564 - Maximum number of times adjacencies can be suppressed
565 - Note, refer vendor documentation for respective valid values
566 type: int
567 ignore_time:
568 description:
569 - Number of minutes during which all adjacencies are suppressed
570 - Note, refer vendor documentation for respective valid values
571 type: int
572 reset_time:
573 description:
574 - Number of minutes after which ignore-count is reset to zero
575 - Note, refer vendor documentation for respective valid values
576 type: int
577 warning_only:
578 description: Only give a warning message when limit is exceeded
579 type: bool
580 max_metric:
581 description: Set maximum metric
582 type: dict
583 suboptions:
584 router_lsa:
585 description: Maximum metric in self-originated router-LSAs
586 type: bool
587 required: true
588 external_lsa:
589 description:
590 - Override external-lsa metric with max-metric value
591 - Overriding metric in external-LSAs
592 - Note, refer vendor documentation for respective valid values
593 type: int
594 include_stub:
595 description: Set maximum metric for stub links in router-LSAs
596 type: bool
597 set_summary_lsa:
598 description: Set summary-lsa metric with max-metric value without metirc value
599 type: bool
600 set_external_lsa:
601 description: Set external-lsa metric with max-metric value without metirc value
602 type: bool
603 on_startup:
604 description: Set maximum metric temporarily after reboot
605 type: dict
606 suboptions:
607 time:
608 description:
609 - Time, in seconds, router-LSAs are originated with max-metric
610 - Note, please refer vendor documentation for respective valid range
611 type: int
612 wait_for_bgp:
613 description: Let BGP decide when to originate router-LSA with normal metric
614 type: bool
615 summary_lsa:
616 description:
617 - Override summary-lsa metric with max-metric value
618 - Note, please refer vendor documentation for respective valid range
619 type: int
620 maximum_paths:
621 description:
622 - Forward packets over multiple paths
623 - Number of paths
624 type: int
625 mpls:
626 description: Configure MPLS routing protocol parameters
627 type: dict
628 suboptions:
629 ldp:
630 description: routing protocol commands for MPLS LDP
631 type: dict
632 suboptions:
633 autoconfig:
634 description: routing protocol commands for MPLS LDP
635 type: dict
636 suboptions:
637 set:
638 description: Configure LDP automatic configuration and set the config
639 type: bool
640 area:
641 description: Configure an OSPF area to run MPLS LDP
642 type: str
643 sync:
644 description: Configure LDP-IGP Synchronization
645 type: bool
646 traffic_eng:
647 description: Let BGP decide when to originate router-LSA with normal metric
648 type: dict
649 suboptions:
650 area:
651 description:
652 - Configure an ospf area to run MPLS Traffic Engineering
653 - OSPF area ID as a decimal value or in IP address format
654 type: str
655 autoroute_exclude:
656 description:
657 - MPLS TE autoroute exclude
658 - Filter prefixes based on name of an IP prefix-list
659 type: str
660 interface:
661 description: MPLS TE interface configuration for this OSPF process
662 type: dict
663 suboptions:
664 interface_type:
665 description: TE Interface configuration (GigabitEthernet A/B)
666 type: str
667 area:
668 description:
669 - Advertise MPLS TE information for this interface into area
670 - OSPF area ID as a decimal value
671 type: int
672 mesh_group:
673 description: Traffic Engineering Mesh-Group advertisement
674 type: dict
675 suboptions:
676 id:
677 description: Mesh Group Id
678 type: int
679 interface:
680 description: Interface configuration (GigabitEthernet A/B)
681 type: str
682 area:
683 description: configure flooding scope as area
684 type: str
685 multicast_intact:
686 description: MPLS TE and PIM interaction
687 type: bool
688 router_id_interface:
689 description: Router Interface configuration (GigabitEthernet A/B)
690 type: str
691 neighbor:
692 description: Specify a neighbor router
693 type: dict
694 suboptions:
695 address:
696 description: Neighbor address (A.B.C.D)
697 type: str
698 cost:
699 description:
700 - OSPF cost for point-to-multipoint neighbor metric
701 - Note, please refer vendor documentation for respective valid range
702 type: int
703 database_filter:
704 description:
705 - Filter OSPF LSA during synchronization and flooding for point-to-multipoint neighbor
706 - Filter all outgoing LSA
707 type: bool
708 poll_interval:
709 description: OSPF dead-router polling interval of non-broadcast neighbor in Seconds
710 type: int
711 priority:
712 description: OSPF priority of non-broadcast neighbor priority
713 type: int
714 network:
715 description: Enable routing on an IP network
716 type: list
717 elements: dict
718 suboptions:
719 address:
720 description: Network number
721 type: str
722 wildcard_bits:
723 description: OSPF wild card bits
724 type: str
725 area:
726 description: Set the OSPF area ID
727 type: str
728 nsf:
729 description: Non-stop forwarding
730 type: dict
731 suboptions:
732 cisco:
733 description: Cisco Non-stop forwarding
734 type: dict
735 suboptions:
736 helper:
737 description: helper support
738 type: bool
739 disable:
740 description: disable helper support
741 type: bool
742 ietf:
743 description: IETF graceful restart
744 type: dict
745 suboptions:
746 helper:
747 description: helper support
748 type: bool
749 disable:
750 description: disable helper support
751 type: bool
752 strict_lsa_checking:
753 description: enable helper strict LSA checking
754 type: bool
755 passive_interface:
756 description:
757 - Suppress routing updates on an interface (GigabitEthernet A/B)
758 - Interface name with respective interface number
759 - passive_interface param is DEPRECATED and a newer param passive_interfaces
760 with added functionality's is introduced, this attribute will be removed after
761 2026-07-18.
762 type: str
763 passive_interfaces:
764 description: Suppress routing updates on an interface
765 type: dict
766 suboptions:
767 default:
768 description: Suppress routing updates on all interfaces
769 type: bool
770 interface:
771 description: Suppress/Un-Suppress routing updates on interface
772 type: dict
773 suboptions:
774 set_interface:
775 description: Suppress/Un-Suppress routing updates
776 type: bool
777 name:
778 description: Name of interface (GigabitEthernet A/B)
779 type: list
780 elements: str
781 prefix_suppression:
782 description: Enable prefix suppression
783 type: bool
784 priority:
785 description:
786 - OSPF topology priority
787 - Note, refer vendor documentation for respective valid values
788 type: int
789 queue_depth:
790 description: Hello/Router process queue depth
791 type: dict
792 suboptions:
793 hello:
794 description: OSPF Hello process queue depth
795 type: dict
796 suboptions:
797 max_packets:
798 description: maximum number of packets in the queue
799 type: int
800 unlimited:
801 description: Unlimited queue depth
802 type: bool
803 update:
804 description: OSPF Router process queue depth
805 type: dict
806 suboptions:
807 max_packets:
808 description: maximum number of packets in the queue
809 type: int
810 unlimited:
811 description: Unlimited queue depth
812 type: bool
813 router_id:
814 description:
815 - Router-id address for this OSPF process
816 - OSPF router-id in IP address format (A.B.C.D)
817 type: str
818 shutdown:
819 description: Shutdown the router process
820 type: bool
821 summary_address:
822 description: Configure IP address summaries
823 type: dict
824 suboptions:
825 address:
826 description: IP summary address
827 type: str
828 mask:
829 description: IP Summary mask
830 type: str
831 not_advertise:
832 description: Do not advertise or translate
833 type: bool
834 nssa_only:
835 description: Limit summary to NSSA areas
836 type: bool
837 tag:
838 description: Set tag
839 type: int
840 timers:
841 description: Adjust routing timers
842 type: dict
843 suboptions:
844 lsa:
845 description:
846 - OSPF LSA timers, arrival timer
847 - The minimum interval in milliseconds between accepting the same LSA
848 - Note, refer vendor documentation for respective valid values
849 type: int
850 pacing:
851 description: OSPF pacing timers
852 type: dict
853 suboptions:
854 flood:
855 description:
856 - OSPF flood pacing timer
857 - The minimum interval in msec to pace limit flooding on interface
858 - Note, refer vendor documentation for respective valid values
859 type: int
860 lsa_group:
861 description:
862 - OSPF LSA group pacing timer
863 - Interval in sec between group of LSA being refreshed or maxaged
864 - Note, refer vendor documentation for respective valid values
865 type: int
866 retransmission:
867 description:
868 - OSPF retransmission pacing timer
869 - The minimum interval in msec between neighbor retransmissions
870 - Note, refer vendor documentation for respective valid values
871 type: int
872 throttle:
873 description: OSPF throttle timers
874 type: dict
875 suboptions:
876 lsa:
877 description: OSPF LSA throttle timers
878 type: dict
879 suboptions:
880 first_delay:
881 description:
882 - Delay to generate first occurrence of LSA in milliseconds
883 - Note, refer vendor documentation for respective valid values
884 type: int
885 min_delay:
886 description:
887 - Minimum delay between originating the same LSA in milliseconds
888 - Note, refer vendor documentation for respective valid values
889 type: int
890 max_delay:
891 description:
892 - Maximum delay between originating the same LSA in milliseconds
893 - Note, refer vendor documentation for respective valid values
894 type: int
895 spf:
896 description: OSPF SPF throttle timers
897 - Delay between receiving a change to SPF calculation in milliseconds
898 - Note, refer vendor documentation for respective valid values
899 type: dict
900 suboptions:
901 receive_delay:
902 description:
903 - Delay between receiving a change to SPF calculation in milliseconds
904 - Note, refer vendor documentation for respective valid values
905 type: int
906 between_delay:
907 description:
908 - Delay between first and second SPF calculation in milliseconds
909 - Note, refer vendor documentation for respective valid values
910 type: int
911 max_delay:
912 description:
913 - Maximum wait time in milliseconds for SPF calculations
914 - Note, refer vendor documentation for respective valid values
915 type: int
916 traffic_share:
917 description:
918 - How to compute traffic share over alternate paths
919 - All traffic shared among min metric paths
920 - Use different interfaces for equal-cost paths
921 type: bool
922 ttl_security:
923 description: TTL security check
924 type: dict
925 suboptions:
926 set:
927 description: Enable TTL Security on all interfaces
928 type: bool
929 hops:
930 description:
931 - Maximum number of IP hops allowed
932 - Note, refer vendor documentation for respective valid values
933 type: int
934 running_config:
935 description:
936 - This option is used only with state I(parsed).
937 - The value of this option should be the output received from the IOS
938 device by executing the command B(sh running-config | section ^router ospf).
939 - The state I(parsed) reads the configuration from C(running_config)
940 option and transforms it into Ansible structured data as per the
941 resource module's argspec and the value is then returned in the
942 I(parsed) key within the result.
943 type: str
944 state:
945 description:
946 - The state the configuration should be left in
947 - The states I(rendered), I(gathered) and I(parsed) does not perform any change
948 on the device.
949 - The state I(rendered) will transform the configuration in C(config) option to
950 platform specific CLI commands which will be returned in the I(rendered) key
951 within the result. For state I(rendered) active connection to remote host is
952 not required.
953 - The state I(gathered) will fetch the running configuration from device and transform
954 it into structured data in the format as per the resource module argspec and
955 the value is returned in the I(gathered) key within the result.
956 - The state I(parsed) reads the configuration from C(running_config) option and
957 transforms it into JSON format as per the resource module parameters and the
958 value is returned in the I(parsed) key within the result. The value of C(running_config)
959 option should be the same format as the output of command I(show running-config
960 | include ip route|ipv6 route) executed on device. For state I(parsed) active
961 connection to remote host is not required.
962 type: str
963 choices:
964 - merged
965 - replaced
966 - overridden
967 - deleted
968 - gathered
969 - parsed
970 - rendered
971 default: merged
972 """
973
974 EXAMPLES = """
975 # Using merged
976
977 # Before state:
978 # -------------
979 #
980 # router-ios#sh running-config | section ^router ospf
981 # router-ios#
982
983 - name: Merge provided OSPF V2 configuration
984 cisco.ios.ios_ospfv2:
985 config:
986 processes:
987 - process_id: 1
988 max_metric:
989 router_lsa: true
990 on_startup:
991 time: 110
992 areas:
993 - area_id: "5"
994 capability: true
995 authentication:
996 enable: true
997 - area_id: "10"
998 authentication:
999 message_digest: true
1000 nssa:
1001 default_information_originate:
1002 metric: 10
1003 translate: suppress-fa
1004 default_cost: 10
1005 filter_list:
1006 - name: test_prefix_in
1007 direction: in
1008 - name: test_prefix_out
1009 direction: out
1010 network:
1011 - address: 198.51.100.0
1012 wildcard_bits: 0.0.0.255
1013 area: 5
1014 default_information:
1015 originate: true
1016 passive_interfaces:
1017 default: true
1018 interface:
1019 set_interface: false
1020 name:
1021 - GigabitEthernet0/1
1022 - GigabitEthernet0/2
1023 - process_id: 200
1024 vrf: blue
1025 domain_id:
1026 ip_address:
1027 address: 192.0.3.1
1028 max_metric:
1029 router_lsa: true
1030 on_startup:
1031 time: 100
1032 auto_cost:
1033 reference_bandwidth: 4
1034 areas:
1035 - area_id: "10"
1036 capability: true
1037 distribute_list:
1038 acls:
1039 - name: 10
1040 direction: out
1041 - name: 123
1042 direction: in
1043 state: merged
1044
1045 # Task Output:
1046 # ------------
1047
1048 # before: {}
1049 # commands:
1050 # - router ospf 200 vrf blue
1051 # - auto-cost reference-bandwidth 4
1052 # - domain-id 192.0.3.1
1053 # - max-metric router-lsa on-startup 100
1054 # - area 10 capability default-exclusion
1055 # - distribute-list 10 out
1056 # - distribute-list 123 in
1057 # - router ospf 1
1058 # - default-information originate
1059 # - max-metric router-lsa on-startup 110
1060 # - area 5 capability default-exclusion
1061 # - area 10 authentication message-digest
1062 # - area 10 default-cost 10
1063 # - area 10 nssa default-information-originate metric 10
1064 # - area 10 nssa translate type7 suppress-fa
1065 # - area 10 filter-list prefix test_prefix_in in
1066 # - area 10 filter-list prefix test_prefix_out out
1067 # - network 198.51.100.0 0.0.0.255 area 5
1068 # - passive-interface default
1069 # - no passive-interface GigabitEthernet0/1
1070 # - no passive-interface GigabitEthernet0/2
1071
1072 # after:
1073 # processes:
1074 # - areas:
1075 # - area_id: '10'
1076 # capability: true
1077 # auto_cost:
1078 # reference_bandwidth: 4
1079 # set: true
1080 # distribute_list:
1081 # acls:
1082 # - direction: out
1083 # name: '10'
1084 # - direction: in
1085 # name: '123'
1086 # domain_id:
1087 # ip_address:
1088 # address: 192.0.3.1
1089 # max_metric:
1090 # on_startup:
1091 # time: 100
1092 # router_lsa: true
1093 # process_id: 200
1094 # vrf: blue
1095 # - areas:
1096 # - area_id: '5'
1097 # capability: true
1098 # - area_id: '10'
1099 # authentication:
1100 # message_digest: true
1101 # default_cost: 10
1102 # filter_list:
1103 # - direction: in
1104 # name: test_prefix_in
1105 # - direction: out
1106 # name: test_prefix_out
1107 # nssa:
1108 # default_information_originate:
1109 # metric: 10
1110 # translate: suppress-fa
1111 # default_information:
1112 # originate: true
1113 # max_metric:
1114 # on_startup:
1115 # time: 110
1116 # router_lsa: true
1117 # network:
1118 # - address: 198.51.100.0
1119 # area: '5'
1120 # wildcard_bits: 0.0.0.255
1121 # passive_interfaces:
1122 # default: true
1123 # interface:
1124 # name:
1125 # - GigabitEthernet2
1126 # - GigabitEthernet1
1127 # set_interface: false
1128 # process_id: 1
1129
1130 # After state:
1131 # ------------
1132 #
1133 # router-ios#sh running-config | section ^router ospf
1134 # router ospf 200 vrf blue
1135 # domain-id 192.0.3.1
1136 # max-metric router-lsa on-startup 100
1137 # auto-cost reference-bandwidth 4
1138 # area 10 capability default-exclusion
1139 # distribute-list 10 out
1140 # distribute-list 123 in
1141 # router ospf 1
1142 # max-metric router-lsa on-startup 110
1143 # area 5 capability default-exclusion
1144 # area 10 authentication message-digest
1145 # area 10 nssa default-information-originate metric 10
1146 # area 10 nssa translate type7 suppress-fa
1147 # area 10 default-cost 10
1148 # area 10 filter-list prefix test_prefix_in in
1149 # area 10 filter-list prefix test_prefix_out out
1150 # passive-interface default
1151 # no passive-interface GigabitEthernet1
1152 # no passive-interface GigabitEthernet2
1153 # network 198.51.100.0 0.0.0.255 area 5
1154 # default-information originate
1155
1156 # Using replaced
1157
1158 # Before state:
1159 # -------------
1160 #
1161 # router-ios#sh running-config | section ^router ospf
1162 # router ospf 200 vrf blue
1163 # domain-id 192.0.3.1
1164 # max-metric router-lsa on-startup 100
1165 # auto-cost reference-bandwidth 4
1166 # area 10 capability default-exclusion
1167 # distribute-list 10 out
1168 # distribute-list 123 in
1169 # router ospf 1
1170 # max-metric router-lsa on-startup 110
1171 # area 5 capability default-exclusion
1172 # area 10 authentication message-digest
1173 # area 10 nssa default-information-originate metric 10
1174 # area 10 nssa translate type7 suppress-fa
1175 # area 10 default-cost 10
1176 # area 10 filter-list prefix test_prefix_in in
1177 # area 10 filter-list prefix test_prefix_out out
1178 # passive-interface default
1179 # no passive-interface GigabitEthernet1
1180 # no passive-interface GigabitEthernet2
1181 # network 198.51.100.0 0.0.0.255 area 5
1182 # default-information originate
1183
1184 - name: Replace running config with provided OSPF V2 configuration
1185 cisco.ios.ios_ospfv2:
1186 config:
1187 processes:
1188 - process_id: 200
1189 vrf: blue
1190 domain_id:
1191 ip_address:
1192 address: 192.0.4.1
1193 max_metric:
1194 router_lsa: true
1195 on_startup:
1196 time: 200
1197 maximum_paths: 15
1198 ttl_security:
1199 hops: 7
1200 areas:
1201 - area_id: "10"
1202 default_cost: 10
1203 authentication:
1204 message_digest: true
1205 - process_id: 100
1206 vrf: ospf_vrf
1207 domain_id:
1208 ip_address:
1209 address: 192.0.5.1
1210 auto_cost:
1211 reference_bandwidth: 5
1212 areas:
1213 - area_id: "5"
1214 authentication:
1215 message_digest: true
1216 nssa:
1217 default_information_originate:
1218 metric: 10
1219 translate: suppress-fa
1220 state: replaced
1221
1222 # Task Output:
1223 # ------------
1224 #
1225 # before:
1226 # processes:
1227 # - areas:
1228 # - area_id: '10'
1229 # capability: true
1230 # auto_cost:
1231 # reference_bandwidth: 4
1232 # set: true
1233 # distribute_list:
1234 # acls:
1235 # - direction: out
1236 # name: '10'
1237 # - direction: in
1238 # name: '123'
1239 # domain_id:
1240 # ip_address:
1241 # address: 192.0.3.1
1242 # max_metric:
1243 # on_startup:
1244 # time: 100
1245 # router_lsa: true
1246 # process_id: 200
1247 # vrf: blue
1248 # - areas:
1249 # - area_id: '5'
1250 # capability: true
1251 # - area_id: '10'
1252 # authentication:
1253 # message_digest: true
1254 # default_cost: 10
1255 # filter_list:
1256 # - direction: in
1257 # name: test_prefix_in
1258 # - direction: out
1259 # name: test_prefix_out
1260 # nssa:
1261 # default_information_originate:
1262 # metric: 10
1263 # translate: suppress-fa
1264 # default_information:
1265 # originate: true
1266 # max_metric:
1267 # on_startup:
1268 # time: 110
1269 # router_lsa: true
1270 # network:
1271 # - address: 198.51.100.0
1272 # area: '5'
1273 # wildcard_bits: 0.0.0.255
1274 # passive_interfaces:
1275 # default: true
1276 # interface:
1277 # name:
1278 # - GigabitEthernet2
1279 # - GigabitEthernet1
1280 # set_interface: false
1281 # process_id: 1
1282 #
1283 # commands:
1284 # - router ospf 100 vrf ospf_vrf
1285 # - auto-cost reference-bandwidth 5
1286 # - domain-id 192.0.5.1
1287 # - area 5 authentication message-digest
1288 # - area 5 nssa translate type7 suppress-fa
1289 # - area 5 nssa default-information-originate metric 10
1290 # - router ospf 200 vrf blue
1291 # - no auto-cost reference-bandwidth 4
1292 # - no distribute-list 10 out
1293 # - no distribute-list 123 in
1294 # - domain-id 192.0.4.1
1295 # - max-metric router-lsa on-startup 200
1296 # - maximum-paths 15
1297 # - ttl-security all-interfaces hops 7
1298 # - area 10 authentication message-digest
1299 # - no area 10 capability default-exclusion
1300 # - area 10 default-cost 10
1301 # ]
1302 #
1303 # after:
1304 # processes:
1305 # - areas:
1306 # - area_id: '10'
1307 # authentication:
1308 # message_digest: true
1309 # default_cost: 10
1310 # domain_id:
1311 # ip_address:
1312 # address: 192.0.4.1
1313 # max_metric:
1314 # on_startup:
1315 # time: 200
1316 # router_lsa: true
1317 # maximum_paths: 15
1318 # process_id: 200
1319 # ttl_security:
1320 # hops: 7
1321 # vrf: blue
1322 # - areas:
1323 # - area_id: '5'
1324 # authentication:
1325 # message_digest: true
1326 # nssa:
1327 # default_information_originate:
1328 # metric: 10
1329 # translate: suppress-fa
1330 # auto_cost:
1331 # reference_bandwidth: 5
1332 # set: true
1333 # domain_id:
1334 # ip_address:
1335 # address: 192.0.5.1
1336 # process_id: 100
1337 # vrf: ospf_vrf
1338 # - areas:
1339 # - area_id: '5'
1340 # authentication:
1341 # enable: true
1342 # capability: true
1343 # - area_id: '10'
1344 # authentication:
1345 # message_digest: true
1346 # default_cost: 10
1347 # filter_list:
1348 # - direction: in
1349 # name: test_prefix_in
1350 # - direction: out
1351 # name: test_prefix_out
1352 # nssa:
1353 # default_information_originate:
1354 # metric: 10
1355 # translate: suppress-fa
1356 # default_information:
1357 # originate: true
1358 # max_metric:
1359 # on_startup:
1360 # time: 110
1361 # router_lsa: true
1362 # network:
1363 # - address: 198.51.100.0
1364 # area: '5'
1365 # wildcard_bits: 0.0.0.255
1366 # process_id: 1
1367
1368 # After state:
1369 # -------------
1370 # router-ios#sh running-config | section ^router ospf
1371 # router ospf 200 vrf blue
1372 # domain-id 192.0.4.1
1373 # max-metric router-lsa on-startup 200
1374 # ttl-security all-interfaces hops 7
1375 # area 10 authentication message-digest
1376 # area 10 default-cost 10
1377 # maximum-paths 15
1378 # router ospf 100 vrf ospf_vrf
1379 # domain-id 192.0.5.1
1380 # auto-cost reference-bandwidth 5
1381 # area 5 authentication message-digest
1382 # area 5 nssa default-information-originate metric 10
1383 # area 5 nssa translate type7 suppress-fa
1384 # router ospf 1
1385 # max-metric router-lsa on-startup 110
1386 # area 5 capability default-exclusion
1387 # area 5 authentication
1388 # area 10 authentication message-digest
1389 # area 10 nssa default-information-originate metric 10
1390 # area 10 nssa translate type7 suppress-fa
1391 # area 10 default-cost 10
1392 # area 10 filter-list prefix test_prefix_in in
1393 # area 10 filter-list prefix test_prefix_out out
1394 # network 198.51.100.0 0.0.0.255 area 5
1395 # default-information originate
1396
1397 # Using overridden
1398
1399 # Before state:
1400 # -------------
1401 #
1402 # router-ios#sh running-config | section ^router ospf
1403 # router ospf 200 vrf blue
1404 # domain-id 192.0.3.1
1405 # max-metric router-lsa on-startup 100
1406 # auto-cost reference-bandwidth 4
1407 # area 10 capability default-exclusion
1408 # distribute-list 10 out
1409 # distribute-list 123 in
1410 # router ospf 1
1411 # max-metric router-lsa on-startup 110
1412 # area 10 authentication message-digest
1413 # area 10 nssa default-information-originate metric 10
1414 # area 10 nssa translate type7 suppress-fa
1415 # area 10 default-cost 10
1416 # area 10 filter-list prefix test_prefix_out out
1417 # network 198.51.100.0 0.0.0.255 area 5
1418 # default-information originate
1419
1420 - name: Override provided OSPF V2 configuration
1421 cisco.ios.ios_ospfv2:
1422 config:
1423 processes:
1424 - process_id: 200
1425 vrf: blue
1426 domain_id:
1427 ip_address:
1428 address: 192.0.4.1
1429 max_metric:
1430 router_lsa: true
1431 on_startup:
1432 time: 200
1433 maximum_paths: 15
1434 ttl_security:
1435 hops: 7
1436 areas:
1437 - area_id: "10"
1438 default_cost: 10
1439 authentication:
1440 message_digest: true
1441 - process_id: 100
1442 vrf: ospf_vrf
1443 domain_id:
1444 ip_address:
1445 address: 192.0.5.1
1446 auto_cost:
1447 reference_bandwidth: 5
1448 areas:
1449 - area_id: "5"
1450 authentication:
1451 message_digest: true
1452 nssa:
1453 default_information_originate:
1454 metric: 10
1455 translate: suppress-fa
1456 state: overridden
1457
1458 # Task Output:
1459 # ------------
1460
1461 # before:
1462 # processes:
1463 # - areas:
1464 # - area_id: '10'
1465 # capability: true
1466 # auto_cost:
1467 # reference_bandwidth: 4
1468 # set: true
1469 # distribute_list:
1470 # acls:
1471 # - direction: out
1472 # name: '10'
1473 # - direction: in
1474 # name: '123'
1475 # domain_id:
1476 # ip_address:
1477 # address: 192.0.3.1
1478 # max_metric:
1479 # on_startup:
1480 # time: 100
1481 # router_lsa: true
1482 # process_id: 200
1483 # vrf: blue
1484 # - areas:
1485 # - area_id: '10'
1486 # authentication:
1487 # message_digest: true
1488 # default_cost: 10
1489 # filter_list:
1490 # - direction: out
1491 # name: test_prefix_out
1492 # nssa:
1493 # default_information_originate:
1494 # metric: 10
1495 # translate: suppress-fa
1496 # default_information:
1497 # originate: true
1498 # max_metric:
1499 # on_startup:
1500 # time: 110
1501 # router_lsa: true
1502 # network:
1503 # - address: 198.51.100.0
1504 # area: '5'
1505 # wildcard_bits: 0.0.0.255
1506 # process_id: 1
1507 #
1508 # commands:
1509 # - no router ospf 1
1510 # - router ospf 100 vrf ospf_vrf
1511 # - auto-cost reference-bandwidth 5
1512 # - domain-id 192.0.5.1
1513 # - area 5 authentication message-digest
1514 # - area 5 nssa translate type7 suppress-fa
1515 # - area 5 nssa default-information-originate metric 10
1516 # - router ospf 200 vrf blue
1517 # - no auto-cost reference-bandwidth 4
1518 # - no distribute-list 10 out
1519 # - no distribute-list 123 in
1520 # - domain-id 192.0.4.1
1521 # - max-metric router-lsa on-startup 200
1522 # - maximum-paths 15
1523 # - ttl-security all-interfaces hops 7
1524 # - area 10 authentication message-digest
1525 # - no area 10 capability default-exclusion
1526 # - area 10 default-cost 10
1527 #
1528 # after:
1529 # processes:
1530 # - areas:
1531 # - area_id: '10'
1532 # authentication:
1533 # message_digest: true
1534 # default_cost: 10
1535 # domain_id:
1536 # ip_address:
1537 # address: 192.0.4.1
1538 # max_metric:
1539 # on_startup:
1540 # time: 200
1541 # router_lsa: true
1542 # maximum_paths: 15
1543 # process_id: 200
1544 # ttl_security:
1545 # hops: 7
1546 # vrf: blue
1547 # - areas:
1548 # - area_id: '5'
1549 # authentication:
1550 # message_digest: true
1551 # nssa:
1552 # default_information_originate:
1553 # metric: 10
1554 # translate: suppress-fa
1555 # auto_cost:
1556 # reference_bandwidth: 5
1557 # set: true
1558 # domain_id:
1559 # ip_address:
1560 # address: 192.0.5.1
1561 # process_id: 100
1562 # vrf: ospf_vrf
1563 #
1564 # After state:
1565 # ------------
1566 #
1567 # router-ios#sh running-config | section ^router ospf
1568 # router ospf 200 vrf blue
1569 # domain-id 192.0.4.1
1570 # max-metric router-lsa on-startup 200
1571 # ttl-security all-interfaces hops 7
1572 # area 10 authentication message-digest
1573 # area 10 default-cost 10
1574 # maximum-paths 15
1575 # router ospf 100 vrf ospf_vrf
1576 # domain-id 192.0.5.1
1577 # auto-cost reference-bandwidth 5
1578 # area 5 authentication message-digest
1579 # area 5 nssa default-information-originate metric 10
1580 # area 5 nssa translate type7 suppress-fa
1581
1582 # Using deleted
1583
1584 # Before state:
1585 # -------------
1586 #
1587 # router-ios#sh running-config | section ^router ospf
1588 # router ospf 200 vrf blue
1589 # domain-id 192.0.3.1
1590 # max-metric router-lsa on-startup 100
1591 # auto-cost reference-bandwidth 4
1592 # area 10 capability default-exclusion
1593 # distribute-list 10 out
1594 # distribute-list 123 in
1595 # router ospf 1
1596 # max-metric router-lsa on-startup 110
1597 # area 10 authentication message-digest
1598 # area 10 nssa default-information-originate metric 10
1599 # area 10 nssa translate type7 suppress-fa
1600 # area 10 default-cost 10
1601 # area 10 filter-list prefix test_prefix_out out
1602 # network 198.51.100.0 0.0.0.255 area 5
1603 # default-information originate
1604
1605 - name: Delete provided OSPF V2 processes
1606 cisco.ios.ios_ospfv2:
1607 config:
1608 processes:
1609 - process_id: 1
1610 - process_id: 200
1611 vrf: blue
1612 state: deleted
1613
1614 # Task Output:
1615 # ------------
1616
1617 # before:
1618 # processes:
1619 # - areas:
1620 # - area_id: '10'
1621 # capability: true
1622 # auto_cost:
1623 # reference_bandwidth: 4
1624 # set: true
1625 # distribute_list:
1626 # acls:
1627 # - direction: out
1628 # name: '10'
1629 # - direction: in
1630 # name: '123'
1631 # domain_id:
1632 # ip_address:
1633 # address: 192.0.3.1
1634 # max_metric:
1635 # on_startup:
1636 # time: 100
1637 # router_lsa: true
1638 # process_id: 200
1639 # vrf: blue
1640 # - areas:
1641 # - area_id: '10'
1642 # authentication:
1643 # message_digest: true
1644 # default_cost: 10
1645 # filter_list:
1646 # - direction: out
1647 # name: test_prefix_out
1648 # nssa:
1649 # default_information_originate:
1650 # metric: 10
1651 # translate: suppress-fa
1652 # default_information:
1653 # originate: true
1654 # max_metric:
1655 # on_startup:
1656 # time: 110
1657 # router_lsa: true
1658 # network:
1659 # - address: 198.51.100.0
1660 # area: '5'
1661 # wildcard_bits: 0.0.0.255
1662 # process_id: 1
1663 #
1664 # commands:
1665 # - no router ospf 1
1666 #
1667 # processes:
1668 # - areas:
1669 # - area_id: '10'
1670 # capability: true
1671 # auto_cost:
1672 # reference_bandwidth: 4
1673 # set: true
1674 # distribute_list:
1675 # acls:
1676 # - direction: out
1677 # name: '10'
1678 # - direction: in
1679 # name: '123'
1680 # domain_id:
1681 # ip_address:
1682 # address: 192.0.3.1
1683 # max_metric:
1684 # on_startup:
1685 # time: 100
1686 # router_lsa: true
1687 # process_id: 200
1688 # vrf: blue
1689 #
1690 # After state:
1691 # ------------
1692 # router-ios#sh running-config | section ^router ospf
1693 # router ospf 200 vrf blue
1694 # domain-id 192.0.3.1
1695 # max-metric router-lsa on-startup 100
1696 # auto-cost reference-bandwidth 4
1697 # area 10 capability default-exclusion
1698 # distribute-list 10 out
1699 # distribute-list 123 in
1700
1701 # Using deleted without any config passed (NOTE: This will delete all OSPFV2 configuration from device)
1702
1703 # Before state:
1704 # -------------
1705 #
1706 # router-ios#sh running-config | section ^router ospf
1707 # router ospf 200 vrf blue
1708 # domain-id 192.0.3.1
1709 # max-metric router-lsa on-startup 100
1710 # auto-cost reference-bandwidth 4
1711 # area 10 capability default-exclusion
1712 # distribute-list 10 out
1713 # distribute-list 123 in
1714 # router ospf 1
1715 # max-metric router-lsa on-startup 110
1716 # area 10 authentication message-digest
1717 # area 10 nssa default-information-originate metric 10
1718 # area 10 nssa translate type7 suppress-fa
1719 # area 10 default-cost 10
1720 # area 10 filter-list prefix test_prefix_out out
1721 # network 198.51.100.0 0.0.0.255 area 5
1722 # default-information originate
1723
1724 - name: Delete all OSPF processes
1725 cisco.ios.ios_ospfv2:
1726 state: deleted
1727
1728 # Task Output:
1729 # ------------
1730
1731 # before:
1732 # processes:
1733 # - areas:
1734 # - area_id: '10'
1735 # capability: true
1736 # auto_cost:
1737 # reference_bandwidth: 4
1738 # set: true
1739 # distribute_list:
1740 # acls:
1741 # - direction: out
1742 # name: '10'
1743 # - direction: in
1744 # name: '123'
1745 # domain_id:
1746 # ip_address:
1747 # address: 192.0.3.1
1748 # max_metric:
1749 # on_startup:
1750 # time: 100
1751 # router_lsa: true
1752 # process_id: 200
1753 # vrf: blue
1754 # - areas:
1755 # - area_id: '10'
1756 # authentication:
1757 # message_digest: true
1758 # default_cost: 10
1759 # filter_list:
1760 # - direction: out
1761 # name: test_prefix_out
1762 # nssa:
1763 # default_information_originate:
1764 # metric: 10
1765 # translate: suppress-fa
1766 # default_information:
1767 # originate: true
1768 # max_metric:
1769 # on_startup:
1770 # time: 110
1771 # router_lsa: true
1772 # network:
1773 # - address: 198.51.100.0
1774 # area: '5'
1775 # wildcard_bits: 0.0.0.255
1776 # process_id: 1
1777 #
1778 # commands:
1779 # - no router ospf 200 vrf blue
1780 # - no router ospf 1
1781 #
1782 # after: {}
1783 #
1784 # After state:
1785 # ------------
1786 # router-ios#sh running-config | section ^router ospf
1787 # router-ios#
1788
1789 # Using Gathered
1790
1791 # Before state:
1792 # -------------
1793 #
1794 # router-ios#sh running-config | section ^router ospf
1795 # router ospf 200 vrf blue
1796 # domain-id 192.0.3.1
1797 # max-metric router-lsa on-startup 100
1798 # auto-cost reference-bandwidth 4
1799 # area 10 capability default-exclusion
1800 # distribute-list 10 out
1801 # distribute-list 123 in
1802 # router ospf 1
1803 # max-metric router-lsa on-startup 110
1804 # area 10 authentication message-digest
1805 # area 10 nssa default-information-originate metric 10
1806 # area 10 nssa translate type7 suppress-fa
1807 # area 10 default-cost 10
1808 # area 10 filter-list prefix test_prefix_out out
1809 # network 198.51.100.0 0.0.0.255 area 5
1810 # default-information originate
1811
1812 - name: Gather OSPFV2 running configurations
1813 cisco.ios.ios_ospfv2:
1814 config:
1815 state: gathered
1816
1817 # Task Output:
1818 # ------------
1819 #
1820 # gathered:
1821 # processes:
1822 # - areas:
1823 # - area_id: '10'
1824 # capability: true
1825 # auto_cost:
1826 # reference_bandwidth: 4
1827 # set: true
1828 # distribute_list:
1829 # acls:
1830 # - direction: out
1831 # name: '10'
1832 # - direction: in
1833 # name: '123'
1834 # domain_id:
1835 # ip_address:
1836 # address: 192.0.3.1
1837 # max_metric:
1838 # on_startup:
1839 # time: 100
1840 # router_lsa: true
1841 # process_id: 200
1842 # vrf: blue
1843 # - areas:
1844 # - area_id: '10'
1845 # authentication:
1846 # message_digest: true
1847 # default_cost: 10
1848 # filter_list:
1849 # - direction: out
1850 # name: test_prefix_out
1851 # nssa:
1852 # default_information_originate:
1853 # metric: 10
1854 # translate: suppress-fa
1855 # default_information:
1856 # originate: true
1857 # max_metric:
1858 # on_startup:
1859 # time: 110
1860 # router_lsa: true
1861 # network:
1862 # - address: 198.51.100.0
1863 # area: '5'
1864 # wildcard_bits: 0.0.0.255
1865 # process_id: 1
1866
1867
1868 # After state:
1869 # ------------
1870 #
1871 # router-ios#sh running-config | section ^router ospf
1872 # router ospf 200 vrf blue
1873 # domain-id 192.0.3.1
1874 # max-metric router-lsa on-startup 100
1875 # auto-cost reference-bandwidth 4
1876 # area 10 capability default-exclusion
1877 # distribute-list 10 out
1878 # distribute-list 123 in
1879 # router ospf 1
1880 # max-metric router-lsa on-startup 110
1881 # area 10 authentication message-digest
1882 # area 10 nssa default-information-originate metric 10
1883 # area 10 nssa translate type7 suppress-fa
1884 # area 10 default-cost 10
1885 # area 10 filter-list prefix test_prefix_out out
1886 # network 198.51.100.0 0.0.0.255 area 5
1887 # default-information originate
1888
1889 # Using Rendered
1890
1891 - name: Render the commands for provided configuration
1892 cisco.ios.ios_ospfv2:
1893 config:
1894 processes:
1895 - process_id: 1
1896 max_metric:
1897 router_lsa: true
1898 on_startup:
1899 time: 110
1900 areas:
1901 - area_id: "5"
1902 capability: true
1903 authentication:
1904 enable: true
1905 - area_id: "10"
1906 authentication:
1907 message_digest: true
1908 nssa:
1909 default_information_originate:
1910 metric: 10
1911 translate: suppress-fa
1912 default_cost: 10
1913 filter_list:
1914 - name: test_prefix_in
1915 direction: in
1916 - name: test_prefix_out
1917 direction: out
1918 network:
1919 - address: 198.51.100.0
1920 wildcard_bits: 0.0.0.255
1921 area: 5
1922 default_information:
1923 originate: true
1924 - process_id: 200
1925 vrf: blue
1926 domain_id:
1927 ip_address:
1928 address: 192.0.3.1
1929 max_metric:
1930 router_lsa: true
1931 on_startup:
1932 time: 100
1933 auto_cost:
1934 reference_bandwidth: 4
1935 areas:
1936 - area_id: "10"
1937 capability: true
1938 distribute_list:
1939 acls:
1940 - name: 10
1941 direction: out
1942 - name: 123
1943 direction: in
1944 state: rendered
1945
1946 # Task Output:
1947 # ------------
1948
1949 # rendered:
1950 # - router ospf 200 vrf blue
1951 # - auto-cost reference-bandwidth 4
1952 # - distribute-list 10 out
1953 # - distribute-list 123 in
1954 # - domain-id 192.0.3.1
1955 # - max-metric router-lsa on-startup 100
1956 # - area 10 capability default-exclusion
1957 # - router ospf 1
1958 # - default-information originate
1959 # - max-metric router-lsa on-startup 110
1960 # - network 198.51.100.0 0.0.0.255 area 5
1961 # - area 10 authentication message-digest
1962 # - area 10 default-cost 10
1963 # - area 10 nssa translate type7 suppress-fa
1964 # - area 10 nssa default-information-originate metric 10
1965 # - area 10 filter-list prefix test_prefix_out out
1966 # - area 10 filter-list prefix test_prefix_in in
1967 # - area 5 authentication
1968 # - area 5 capability default-exclusion
1969 #
1970
1971 # Using Parsed
1972
1973 # File: parsed.cfg
1974 # ----------------
1975 #
1976 # router ospf 100
1977 # auto-cost reference-bandwidth 5
1978 # domain-id 192.0.5.1
1979 # area 5 authentication message-digest
1980 # area 5 nssa translate type7 suppress-fa
1981 # area 5 nssa default-information-originate metric 10
1982
1983 - name: Parse the provided configuration with the existing running configuration
1984 cisco.ios.ios_ospfv2:
1985 running_config: "{{ lookup('file', 'parsed.cfg') }}"
1986 state: parsed
1987
1988 # Task Output:
1989 # ------------
1990
1991 # parsed:
1992 # processes:
1993 # - areas:
1994 # - area_id: '5'
1995 # authentication:
1996 # message_digest: true
1997 # nssa:
1998 # default_information_originate:
1999 # metric: 10
2000 # translate: suppress-fa
2001 # auto_cost:
2002 # reference_bandwidth: 5
2003 # set: true
2004 # domain_id:
2005 # ip_address:
2006 # address: 192.0.5.1
2007 # process_id: 100
2008 """
2009
2010 RETURN = """
2011 before:
2012 description: The configuration prior to the model invocation.
2013 returned: always
2014 sample: >
2015 The configuration returned will always be in the same format
2016 of the parameters above.
2017 type: dict
2018 after:
2019 description: The resulting configuration model invocation.
2020 returned: when changed
2021 sample: >
2022 The configuration returned will always be in the same format
2023 of the parameters above.
2024 type: dict
2025 commands:
2026 description: The set of commands pushed to the remote device.
2027 returned: always
2028 type: list
2029 sample: ['router ospf 200 vrf blue', 'auto-cost reference-bandwidth 5', 'domain-id 192.0.4.1']
2030 rendered:
2031 description: The provided configuration in the task rendered in device-native format (offline).
2032 returned: when I(state) is C(rendered)
2033 type: list
2034 sample:
2035 - router ospf 200 vrf blue
2036 - auto-cost reference-bandwidth 4
2037 - distribute-list 10 out
2038 gathered:
2039 description: Facts about the network resource gathered from the remote device as structured data.
2040 returned: when I(state) is C(gathered)
2041 type: dict
2042 sample: >
2043 This output will always be in the same format as the
2044 module argspec.
2045 parsed:
2046 description: The device native config provided in I(running_config) option parsed into structured data as per module argspec.
2047 returned: when I(state) is C(parsed)
2048 type: dict
2049 sample: >
2050 This output will always be in the same format as the
2051 module argspec.
2052 """
2053
2054
2055 from ansible.module_utils.basic import AnsibleModule
2056
2057 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.ospfv2.ospfv2 import (
2058 Ospfv2Args,
2059 )
2060 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.ospfv2.ospfv2 import (
2061 Ospfv2,
2062 )
2063
2064
2065 def main():
2066 """
2067 Main entry point for module execution
2068 :returns: the result form module invocation
2069 """
2070 required_if = [
2071 ("state", "merged", ("config",)),
2072 ("state", "replaced", ("config",)),
2073 ("state", "overridden", ("config",)),
2074 ("state", "rendered", ("config",)),
2075 ("state", "parsed", ("running_config",)),
2076 ]
2077
2078 mutually_exclusive = [("config", "running_config")]
2079
2080 module = AnsibleModule(
2081 argument_spec=Ospfv2Args.argument_spec,
2082 required_if=required_if,
2083 mutually_exclusive=mutually_exclusive,
2084 supports_check_mode=True,
2085 )
2086
2087 result = Ospfv2(module).execute_module()
2088 module.exit_json(**result)
2089
2090
2091 if __name__ == "__main__":
2092 main()