Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_dhcp_relay_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_dhcp_relay_module:
2
3
4 *****************************************
5 dellemc.enterprise_sonic.sonic_dhcp_relay
6 *****************************************
7
8 **Manage DHCP and DHCPv6 relay configurations on SONiC**
9
10
11 Version added: 2.1.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides configuration management of DHCP and DHCPv6 relay parameters on Layer 3 interfaces of devices running SONiC.
21 - Layer 3 interface and VRF name need to be created earlier in the device.
22
23
24
25
26 Parameters
27 ----------
28
29 .. raw:: html
30
31 <table border=0 cellpadding=0 class="documentation-table">
32 <tr>
33 <th colspan="4">Parameter</th>
34 <th>Choices/<font color="blue">Defaults</font></th>
35 <th width="100%">Comments</th>
36 </tr>
37 <tr>
38 <td colspan="4">
39 <div class="ansibleOptionAnchor" id="parameter-"></div>
40 <b>config</b>
41 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
42 <div style="font-size: small">
43 <span style="color: purple">list</span>
44 / <span style="color: purple">elements=dictionary</span>
45 </div>
46 </td>
47 <td>
48 </td>
49 <td>
50 <div>Specifies the DHCP and DHCPv6 relay configurations.</div>
51 </td>
52 </tr>
53 <tr>
54 <td class="elbow-placeholder"></td>
55 <td colspan="3">
56 <div class="ansibleOptionAnchor" id="parameter-"></div>
57 <b>ipv4</b>
58 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
59 <div style="font-size: small">
60 <span style="color: purple">dictionary</span>
61 </div>
62 </td>
63 <td>
64 </td>
65 <td>
66 <div>DHCP relay configurations to be set for the interface mentioned in name option.</div>
67 </td>
68 </tr>
69 <tr>
70 <td class="elbow-placeholder"></td>
71 <td class="elbow-placeholder"></td>
72 <td colspan="2">
73 <div class="ansibleOptionAnchor" id="parameter-"></div>
74 <b>circuit_id</b>
75 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
76 <div style="font-size: small">
77 <span style="color: purple">string</span>
78 </div>
79 </td>
80 <td>
81 <ul style="margin: 0; padding: 0"><b>Choices:</b>
82 <li>%h:%p</li>
83 <li>%i</li>
84 <li>%p</li>
85 </ul>
86 </td>
87 <td>
88 <div>Specifies the DHCP relay circuit-id format.</div>
89 <div><code>%h:%p</code> - Hostname followed by interface name eg. sonic:Vlan100</div>
90 <div><code>%i</code> - Name of the physical interface eg. Eth1/2</div>
91 <div><code>%p</code> - Name of the interface eg. Vlan100</div>
92 </td>
93 </tr>
94 <tr>
95 <td class="elbow-placeholder"></td>
96 <td class="elbow-placeholder"></td>
97 <td colspan="2">
98 <div class="ansibleOptionAnchor" id="parameter-"></div>
99 <b>link_select</b>
100 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
101 <div style="font-size: small">
102 <span style="color: purple">boolean</span>
103 </div>
104 </td>
105 <td>
106 <ul style="margin: 0; padding: 0"><b>Choices:</b>
107 <li>no</li>
108 <li>yes</li>
109 </ul>
110 </td>
111 <td>
112 <div>Enable link selection suboption.</div>
113 </td>
114 </tr>
115 <tr>
116 <td class="elbow-placeholder"></td>
117 <td class="elbow-placeholder"></td>
118 <td colspan="2">
119 <div class="ansibleOptionAnchor" id="parameter-"></div>
120 <b>max_hop_count</b>
121 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
122 <div style="font-size: small">
123 <span style="color: purple">integer</span>
124 </div>
125 </td>
126 <td>
127 </td>
128 <td>
129 <div>Specifies the maximum hop count for DHCP relay packets.</div>
130 <div>The range is from 1 to 16.</div>
131 </td>
132 </tr>
133 <tr>
134 <td class="elbow-placeholder"></td>
135 <td class="elbow-placeholder"></td>
136 <td colspan="2">
137 <div class="ansibleOptionAnchor" id="parameter-"></div>
138 <b>policy_action</b>
139 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
140 <div style="font-size: small">
141 <span style="color: purple">string</span>
142 </div>
143 </td>
144 <td>
145 <ul style="margin: 0; padding: 0"><b>Choices:</b>
146 <li>append</li>
147 <li>discard</li>
148 <li>replace</li>
149 </ul>
150 </td>
151 <td>
152 <div>Specifies the policy for handling of DHCP relay options.</div>
153 </td>
154 </tr>
155 <tr>
156 <td class="elbow-placeholder"></td>
157 <td class="elbow-placeholder"></td>
158 <td colspan="2">
159 <div class="ansibleOptionAnchor" id="parameter-"></div>
160 <b>server_addresses</b>
161 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
162 <div style="font-size: small">
163 <span style="color: purple">list</span>
164 / <span style="color: purple">elements=dictionary</span>
165 </div>
166 </td>
167 <td>
168 </td>
169 <td>
170 <div>List of DHCP server IPv4 addresses.</div>
171 </td>
172 </tr>
173 <tr>
174 <td class="elbow-placeholder"></td>
175 <td class="elbow-placeholder"></td>
176 <td class="elbow-placeholder"></td>
177 <td colspan="1">
178 <div class="ansibleOptionAnchor" id="parameter-"></div>
179 <b>address</b>
180 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
181 <div style="font-size: small">
182 <span style="color: purple">string</span>
183 </div>
184 </td>
185 <td>
186 </td>
187 <td>
188 <div>IPv4 address of the DHCP server.</div>
189 </td>
190 </tr>
191
192 <tr>
193 <td class="elbow-placeholder"></td>
194 <td class="elbow-placeholder"></td>
195 <td colspan="2">
196 <div class="ansibleOptionAnchor" id="parameter-"></div>
197 <b>source_interface</b>
198 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
199 <div style="font-size: small">
200 <span style="color: purple">string</span>
201 </div>
202 </td>
203 <td>
204 </td>
205 <td>
206 <div>Specifies the DHCP relay source interface.</div>
207 </td>
208 </tr>
209 <tr>
210 <td class="elbow-placeholder"></td>
211 <td class="elbow-placeholder"></td>
212 <td colspan="2">
213 <div class="ansibleOptionAnchor" id="parameter-"></div>
214 <b>vrf_name</b>
215 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
216 <div style="font-size: small">
217 <span style="color: purple">string</span>
218 </div>
219 </td>
220 <td>
221 </td>
222 <td>
223 <div>Specifies name of the VRF in which the DHCP server resides.</div>
224 <div>This option is not used with state <em>deleted</em>.</div>
225 </td>
226 </tr>
227 <tr>
228 <td class="elbow-placeholder"></td>
229 <td class="elbow-placeholder"></td>
230 <td colspan="2">
231 <div class="ansibleOptionAnchor" id="parameter-"></div>
232 <b>vrf_select</b>
233 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
234 <div style="font-size: small">
235 <span style="color: purple">boolean</span>
236 </div>
237 </td>
238 <td>
239 <ul style="margin: 0; padding: 0"><b>Choices:</b>
240 <li>no</li>
241 <li>yes</li>
242 </ul>
243 </td>
244 <td>
245 <div>Enable VRF selection suboption.</div>
246 </td>
247 </tr>
248
249 <tr>
250 <td class="elbow-placeholder"></td>
251 <td colspan="3">
252 <div class="ansibleOptionAnchor" id="parameter-"></div>
253 <b>ipv6</b>
254 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
255 <div style="font-size: small">
256 <span style="color: purple">dictionary</span>
257 </div>
258 </td>
259 <td>
260 </td>
261 <td>
262 <div>DHCPv6 relay configurations to be set for the interface mentioned in name option.</div>
263 </td>
264 </tr>
265 <tr>
266 <td class="elbow-placeholder"></td>
267 <td class="elbow-placeholder"></td>
268 <td colspan="2">
269 <div class="ansibleOptionAnchor" id="parameter-"></div>
270 <b>max_hop_count</b>
271 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
272 <div style="font-size: small">
273 <span style="color: purple">integer</span>
274 </div>
275 </td>
276 <td>
277 </td>
278 <td>
279 <div>Specifies the maximum hop count for DHCPv6 relay packets.</div>
280 <div>The range is from 1 to 16.</div>
281 </td>
282 </tr>
283 <tr>
284 <td class="elbow-placeholder"></td>
285 <td class="elbow-placeholder"></td>
286 <td colspan="2">
287 <div class="ansibleOptionAnchor" id="parameter-"></div>
288 <b>server_addresses</b>
289 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
290 <div style="font-size: small">
291 <span style="color: purple">list</span>
292 / <span style="color: purple">elements=dictionary</span>
293 </div>
294 </td>
295 <td>
296 </td>
297 <td>
298 <div>List of DHCPv6 server IPv6 addresses.</div>
299 </td>
300 </tr>
301 <tr>
302 <td class="elbow-placeholder"></td>
303 <td class="elbow-placeholder"></td>
304 <td class="elbow-placeholder"></td>
305 <td colspan="1">
306 <div class="ansibleOptionAnchor" id="parameter-"></div>
307 <b>address</b>
308 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
309 <div style="font-size: small">
310 <span style="color: purple">string</span>
311 </div>
312 </td>
313 <td>
314 </td>
315 <td>
316 <div>IPv6 address of the DHCPv6 server.</div>
317 </td>
318 </tr>
319
320 <tr>
321 <td class="elbow-placeholder"></td>
322 <td class="elbow-placeholder"></td>
323 <td colspan="2">
324 <div class="ansibleOptionAnchor" id="parameter-"></div>
325 <b>source_interface</b>
326 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
327 <div style="font-size: small">
328 <span style="color: purple">string</span>
329 </div>
330 </td>
331 <td>
332 </td>
333 <td>
334 <div>Specifies the DHCPv6 relay source interface.</div>
335 </td>
336 </tr>
337 <tr>
338 <td class="elbow-placeholder"></td>
339 <td class="elbow-placeholder"></td>
340 <td colspan="2">
341 <div class="ansibleOptionAnchor" id="parameter-"></div>
342 <b>vrf_name</b>
343 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
344 <div style="font-size: small">
345 <span style="color: purple">string</span>
346 </div>
347 </td>
348 <td>
349 </td>
350 <td>
351 <div>Specifies name of the VRF in which the DHCPv6 server resides.</div>
352 <div>This option is used only with state <em>merged</em>.</div>
353 </td>
354 </tr>
355 <tr>
356 <td class="elbow-placeholder"></td>
357 <td class="elbow-placeholder"></td>
358 <td colspan="2">
359 <div class="ansibleOptionAnchor" id="parameter-"></div>
360 <b>vrf_select</b>
361 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
362 <div style="font-size: small">
363 <span style="color: purple">boolean</span>
364 </div>
365 </td>
366 <td>
367 <ul style="margin: 0; padding: 0"><b>Choices:</b>
368 <li>no</li>
369 <li>yes</li>
370 </ul>
371 </td>
372 <td>
373 <div>Enable VRF selection suboption.</div>
374 </td>
375 </tr>
376
377 <tr>
378 <td class="elbow-placeholder"></td>
379 <td colspan="3">
380 <div class="ansibleOptionAnchor" id="parameter-"></div>
381 <b>name</b>
382 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
383 <div style="font-size: small">
384 <span style="color: purple">string</span>
385 / <span style="color: red">required</span>
386 </div>
387 </td>
388 <td>
389 </td>
390 <td>
391 <div>Full name of the Layer 3 interface, i.e. Eth1/1.</div>
392 </td>
393 </tr>
394
395 <tr>
396 <td colspan="4">
397 <div class="ansibleOptionAnchor" id="parameter-"></div>
398 <b>state</b>
399 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
400 <div style="font-size: small">
401 <span style="color: purple">string</span>
402 </div>
403 </td>
404 <td>
405 <ul style="margin: 0; padding: 0"><b>Choices:</b>
406 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
407 <li>deleted</li>
408 <li>replaced</li>
409 <li>overridden</li>
410 </ul>
411 </td>
412 <td>
413 <div>The state of the configuration after module completion.</div>
414 <div><code>merged</code> - Merges provided DHCP and DHCPv6 relay configuration with on-device configuration.</div>
415 <div><code>deleted</code> - Deletes on-device DHCP and DHCPv6 relay configuration.</div>
416 <div><code>replaced</code> - Replaces on-device DHCP and DHCPv6 relay configuration of the specified interfaces with provided configuration.</div>
417 <div><code>overridden</code> - Overrides all on-device DHCP and DHCPv6 relay configurations with the provided configuration.</div>
418 </td>
419 </tr>
420 </table>
421 <br/>
422
423
424 Notes
425 -----
426
427 .. note::
428 - Tested against Enterprise SONiC Distribution by Dell Technologies.
429 - Supports ``check_mode``.
430
431
432
433 Examples
434 --------
435
436 .. code-block:: yaml
437
438 # Using "deleted" state
439 #
440 # Before state:
441 # -------------
442 #
443 # sonic# show running-configuration interface
444 # !
445 # interface Eth1/1
446 # mtu 9100
447 # speed 400000
448 # fec RS
449 # no shutdown
450 # ip address 81.1.1.1/24
451 # ip dhcp-relay 91.1.1.1 92.1.1.1 vrf VrfReg1
452 # ip dhcp-relay max-hop-count 5
453 # ip dhcp-relay vrf-select
454 # ip dhcp-relay policy-action append
455 # ipv6 address 81::1/24
456 # ipv6 dhcp-relay 91::1 92::1
457 # ipv6 dhcp-relay max-hop-count 5
458 # !
459 # interface Eth1/2
460 # mtu 9100
461 # speed 400000
462 # fec RS
463 # no shutdown
464 # ip address 61.1.1.1/24
465 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
466 # ip dhcp-relay source-interface Vlan100
467 # ip dhcp-relay link-select
468 # ip dhcp-relay circuit-id %h:%p
469 # !
470
471 - name: Delete DHCP and DHCPv6 relay configurations
472 dellemc.enterprise_sonic.sonic_dhcp_relay:
473 config:
474 - name: 'Eth1/1'
475 ipv4:
476 server_addresses:
477 - address: '92.1.1.1'
478 vrf_select: true
479 max_hop_count: 5
480 ipv6:
481 server_addresses:
482 - address: '91::1'
483 - address: '92::1'
484 - name: 'Eth1/2'
485 ipv4:
486 server_addresses:
487 - address: '71.1.1.1'
488 - address: '72.1.1.1'
489 source_interface: 'Vlan100'
490 link_select: true
491 circuit_id: '%h:%p'
492 state: deleted
493
494 # After state:
495 # ------------
496 #
497 # sonic# show running-configuration interface
498 # !
499 # interface Eth1/1
500 # mtu 9100
501 # speed 400000
502 # fec RS
503 # no shutdown
504 # ip address 81.1.1.1/24
505 # ip dhcp-relay 91.1.1.1 vrf VrfReg1
506 # ip dhcp-relay policy-action append
507 # ipv6 address 81::1/24
508 # !
509 # interface Eth1/2
510 # mtu 9100
511 # speed 400000
512 # fec RS
513 # no shutdown
514 # ip address 61.1.1.1/24
515 # ip dhcp-relay 73.1.1.1
516 # !
517
518
519 # Using "deleted" state
520 #
521 # NOTE: Support is provided in the dhcp_relay resource module for deletion of all attributes for a
522 # given address family (IPv4 or IPv6) by using a "special" YAML sequence specifying a server address list
523 # containing a single "blank" IP address under the target address family. The following example shows
524 # a task using this syntax for deletion of all DHCP (IPv4) configurations for an interface, but the
525 # equivalent syntax is supported for DHCPv6 (IPv6) as well.
526 #
527 # Before state:
528 # -------------
529 #
530 # sonic# show running-configuration interface
531 # !
532 # interface Eth1/1
533 # mtu 9100
534 # speed 400000
535 # fec RS
536 # no shutdown
537 # ip address 81.1.1.1/24
538 # ip dhcp-relay 91.1.1.1 92.1.1.1 vrf VrfReg1
539 # ip dhcp-relay max-hop-count 5
540 # ip dhcp-relay vrf-select
541 # ip dhcp-relay policy-action append
542 # ipv6 address 81::1/24
543 # ipv6 dhcp-relay 91::1 92::1
544 # ipv6 dhcp-relay max-hop-count 5
545 # !
546 # interface Eth1/2
547 # mtu 9100
548 # speed 400000
549 # fec RS
550 # no shutdown
551 # ip address 61.1.1.1/24
552 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
553 # ip dhcp-relay source-interface Vlan100
554 # ip dhcp-relay link-select
555 # ip dhcp-relay circuit-id %h:%p
556 # !
557
558 - name: Delete all IPv4 DHCP relay configurations for interface Eth1/1
559 dellemc.enterprise_sonic.sonic_dhcp_relay:
560 config:
561 - name: 'Eth1/1'
562 ipv4:
563 server_addresses:
564 - address:
565 state: deleted
566
567 # After state:
568 # ------------
569 #
570 # sonic# show running-configuration interface
571 # !
572 # interface Eth1/1
573 # mtu 9100
574 # speed 400000
575 # fec RS
576 # no shutdown
577 # ip address 81.1.1.1/24
578 # ipv6 address 81::1/24
579 # ipv6 dhcp-relay 91::1 92::1
580 # ipv6 dhcp-relay max-hop-count 5
581 # !
582 # interface Eth1/2
583 # mtu 9100
584 # speed 400000
585 # fec RS
586 # no shutdown
587 # ip address 61.1.1.1/24
588 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
589 # ip dhcp-relay source-interface Vlan100
590 # ip dhcp-relay link-select
591 # ip dhcp-relay circuit-id %h:%p
592 # !
593
594
595 # Using "deleted" state
596 #
597 # Before state:
598 # -------------
599 #
600 # sonic# show running-configuration interface
601 # !
602 # interface Eth1/1
603 # mtu 9100
604 # speed 400000
605 # fec RS
606 # no shutdown
607 # ip address 81.1.1.1/24
608 # ip dhcp-relay 91.1.1.1 92.1.1.1 vrf VrfReg1
609 # ip dhcp-relay max-hop-count 5
610 # ip dhcp-relay vrf-select
611 # ip dhcp-relay policy-action append
612 # ipv6 address 81::1/24
613 # ipv6 dhcp-relay 91::1 92::1
614 # ipv6 dhcp-relay max-hop-count 5
615 # !
616 # interface Eth1/2
617 # mtu 9100
618 # speed 400000
619 # fec RS
620 # no shutdown
621 # ip address 61.1.1.1/24
622 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
623 # ip dhcp-relay source-interface Vlan100
624 # ip dhcp-relay link-select
625 # ip dhcp-relay circuit-id %h:%p
626 # !
627
628 - name: Delete all DHCP and DHCPv6 relay configurations for interface Eth1/1
629 dellemc.enterprise_sonic.sonic_dhcp_relay:
630 config:
631 - name: 'Eth1/1'
632 state: deleted
633
634 # After state:
635 # ------------
636 #
637 # sonic# show running-configuration interface
638 # !
639 # interface Eth1/1
640 # mtu 9100
641 # speed 400000
642 # fec RS
643 # no shutdown
644 # ip address 81.1.1.1/24
645 # ipv6 address 81::1/24
646 # !
647 # interface Eth1/2
648 # mtu 9100
649 # speed 400000
650 # fec RS
651 # no shutdown
652 # ip address 61.1.1.1/24
653 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
654 # ip dhcp-relay source-interface Vlan100
655 # ip dhcp-relay link-select
656 # ip dhcp-relay circuit-id %h:%p
657 # !
658
659
660 # Using "deleted" state
661 #
662 # Before state:
663 # -------------
664 #
665 # sonic# show running-configuration interface
666 # !
667 # interface Eth1/1
668 # mtu 9100
669 # speed 400000
670 # fec RS
671 # no shutdown
672 # ip address 81.1.1.1/24
673 # ip dhcp-relay 91.1.1.1 92.1.1.1 vrf VrfReg1
674 # ip dhcp-relay max-hop-count 5
675 # ip dhcp-relay vrf-select
676 # ip dhcp-relay policy-action append
677 # ipv6 address 81::1/24
678 # ipv6 dhcp-relay 91::1 92::1
679 # ipv6 dhcp-relay max-hop-count 5
680 # !
681 # interface Eth1/2
682 # mtu 9100
683 # speed 400000
684 # fec RS
685 # no shutdown
686 # ip address 61.1.1.1/24
687 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
688 # ip dhcp-relay source-interface Vlan100
689 # ip dhcp-relay link-select
690 # ip dhcp-relay circuit-id %h:%p
691 # !
692
693 - name: Delete all DHCP and DHCPv6 relay configurations
694 dellemc.enterprise_sonic.sonic_dhcp_relay:
695 config:
696 state: deleted
697
698 # After state:
699 # ------------
700 #
701 # sonic# show running-configuration interface
702 # !
703 # interface Eth1/1
704 # mtu 9100
705 # speed 400000
706 # fec RS
707 # no shutdown
708 # ip address 81.1.1.1/24
709 # ipv6 address 81::1/24
710 # !
711 # interface Eth1/2
712 # mtu 9100
713 # speed 400000
714 # fec RS
715 # no shutdown
716 # ip address 61.1.1.1/24
717 # !
718
719
720 # Using "merged" state
721 #
722 # Before state:
723 # -------------
724 #
725 # sonic# show running-configuration interface
726 # !
727 # interface Eth1/1
728 # mtu 9100
729 # speed 400000
730 # fec RS
731 # no shutdown
732 # ip address 81.1.1.1/24
733 # ipv6 address 81::1/24
734 # !
735 # interface Eth1/2
736 # mtu 9100
737 # speed 400000
738 # fec RS
739 # no shutdown
740 # ip address 61.1.1.1/24
741 # ip dhcp-relay 71.1.1.1 72.1.1.1
742 # !
743
744 - name: Add DHCP and DHCPv6 relay configurations
745 dellemc.enterprise_sonic.sonic_dhcp_relay:
746 config:
747 - name: 'Eth1/1'
748 ipv4:
749 server_addresses:
750 - address: '91.1.1.1'
751 - address: '92.1.1.1'
752 vrf_name: 'VrfReg1'
753 vrf_select: true
754 max_hop_count: 5
755 policy_action: 'append'
756 ipv6:
757 server_addresses:
758 - address: '91::1'
759 - address: '92::1'
760 max_hop_count: 5
761 - name: 'Eth1/2'
762 ipv4:
763 server_addresses:
764 - address: '73.1.1.1'
765 source_interface: 'Vlan100'
766 link_select: true
767 circuit_id: '%h:%p'
768 state: merged
769
770 # After state:
771 # ------------
772 #
773 # sonic# show running-configuration interface
774 # !
775 # interface Eth1/1
776 # mtu 9100
777 # speed 400000
778 # fec RS
779 # no shutdown
780 # ip address 81.1.1.1/24
781 # ip dhcp-relay 91.1.1.1 92.1.1.1 vrf VrfReg1
782 # ip dhcp-relay max-hop-count 5
783 # ip dhcp-relay vrf-select
784 # ip dhcp-relay policy-action append
785 # ipv6 address 81::1/24
786 # ipv6 dhcp-relay 91::1 92::1
787 # ipv6 dhcp-relay max-hop-count 5
788 # !
789 # interface Eth1/2
790 # mtu 9100
791 # speed 400000
792 # fec RS
793 # no shutdown
794 # ip address 61.1.1.1/24
795 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
796 # ip dhcp-relay source-interface Vlan100
797 # ip dhcp-relay link-select
798 # ip dhcp-relay circuit-id %h:%p
799 # !
800
801
802 # Using "replaced" state
803 #
804 # Before state:
805 # -------------
806 #
807 # sonic# show running-configuration interface
808 # !
809 # interface Eth1/1
810 # mtu 9100
811 # speed 400000
812 # fec RS
813 # no shutdown
814 # ip address 81.1.1.1/24
815 # ip dhcp-relay 91.1.1.1 92.1.1.1 vrf VrfReg1
816 # ip dhcp-relay max-hop-count 5
817 # ip dhcp-relay vrf-select
818 # ip dhcp-relay policy-action append
819 # ipv6 address 81::1/24
820 # ipv6 dhcp-relay 91::1 92::1
821 # ipv6 dhcp-relay max-hop-count 5
822 # !
823 # interface Eth1/2
824 # mtu 9100
825 # speed 400000
826 # fec RS
827 # no shutdown
828 # ip address 61.1.1.1/24
829 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
830 # ip dhcp-relay source-interface Vlan100
831 # ip dhcp-relay link-select
832 # ip dhcp-relay circuit-id %h:%p
833 # ipv6 address 61::1/24
834 # ipv6 dhcp-relay 71::1 72::1
835 # !
836 # interface Eth1/3
837 # mtu 9100
838 # speed 400000
839 # fec RS
840 # shutdown
841 # ip address 41.1.1.1/24
842 # ip dhcp-relay 51.1.1.1 52.1.1.1
843 # ip dhcp-relay circuit-id %h:%p
844 # ipv6 address 41::1/24
845 # ipv6 dhcp-relay 51::1 52::1
846 # !
847
848 - name: Replace DHCP and DHCPv6 relay configurations of specified interfaces
849 dellemc.enterprise_sonic.sonic_dhcp_relay:
850 config:
851 - name: 'Eth1/1'
852 ipv4:
853 server_addresses:
854 - address: '91.1.1.1'
855 - address: '93.1.1.1'
856 - address: '95.1.1.1'
857 vrf_name: 'VrfReg1'
858 vrf_select: true
859 ipv6:
860 server_addresses:
861 - address: '93::1'
862 - address: '94::1'
863 source_interface: 'Vlan100'
864 - name: 'Eth1/2'
865 ipv4:
866 server_addresses:
867 - address: '73.1.1.1'
868 circuit_id: '%h:%p'
869 state: replaced
870
871 # After state:
872 # ------------
873 #
874 # sonic# show running-configuration interface
875 # !
876 # interface Eth1/1
877 # mtu 9100
878 # speed 400000
879 # fec RS
880 # no shutdown
881 # ip address 81.1.1.1/24
882 # ip dhcp-relay 91.1.1.1 93.1.1.1 95.1.1.1 vrf VrfReg1
883 # ip dhcp-relay vrf-select
884 # ipv6 address 81::1/24
885 # ipv6 dhcp-relay 93::1 94::1
886 # ipv6 dhcp-relay source-interface Vlan100
887 # !
888 # interface Eth1/2
889 # mtu 9100
890 # speed 400000
891 # fec RS
892 # no shutdown
893 # ip address 61.1.1.1/24
894 # ip dhcp-relay 73.1.1.1
895 # ip dhcp-relay circuit-id %h:%p
896 # ipv6 address 61::1/24
897 # !
898 # interface Eth1/3
899 # mtu 9100
900 # speed 400000
901 # fec RS
902 # shutdown
903 # ip address 41.1.1.1/24
904 # ip dhcp-relay 51.1.1.1 52.1.1.1
905 # ip dhcp-relay circuit-id %h:%p
906 # ipv6 address 41::1/24
907 # ipv6 dhcp-relay 51::1 52::1
908 # !
909
910
911 # Using "overridden" state
912 #
913 # Before state:
914 # -------------
915 #
916 # sonic# show running-configuration interface
917 # !
918 # interface Eth1/1
919 # mtu 9100
920 # speed 400000
921 # fec RS
922 # no shutdown
923 # ip address 81.1.1.1/24
924 # ip dhcp-relay 91.1.1.1 92.1.1.1 vrf VrfReg1
925 # ip dhcp-relay max-hop-count 5
926 # ip dhcp-relay vrf-select
927 # ip dhcp-relay policy-action append
928 # ipv6 address 81::1/24
929 # ipv6 dhcp-relay 91::1 92::1
930 # ipv6 dhcp-relay max-hop-count 5
931 # !
932 # interface Eth1/2
933 # mtu 9100
934 # speed 400000
935 # fec RS
936 # no shutdown
937 # ip address 61.1.1.1/24
938 # ip dhcp-relay 71.1.1.1 72.1.1.1 73.1.1.1
939 # ip dhcp-relay source-interface Vlan100
940 # ip dhcp-relay link-select
941 # ip dhcp-relay circuit-id %h:%p
942 # ipv6 address 61::1/24
943 # ipv6 dhcp-relay 71::1 72::1
944 # !
945 # interface Eth1/3
946 # mtu 9100
947 # speed 400000
948 # fec RS
949 # shutdown
950 # ip address 41.1.1.1/24
951 # ip dhcp-relay 51.1.1.1 52.1.1.1
952 # ip dhcp-relay circuit-id %h:%p
953 # ipv6 address 41::1/24
954 # ipv6 dhcp-relay 51::1 52::1
955 # !
956
957 - name: Override DHCP and DHCPv6 relay configurations
958 dellemc.enterprise_sonic.sonic_dhcp_relay:
959 config:
960 - name: 'Eth1/1'
961 ipv4:
962 server_addresses:
963 - address: '91.1.1.1'
964 - address: '93.1.1.1'
965 - address: '95.1.1.1'
966 vrf_name: 'VrfReg1'
967 vrf_select: true
968 ipv6:
969 server_addresses:
970 - address: '93::1'
971 - address: '94::1'
972 source_interface: 'Vlan100'
973 - name: 'Eth1/2'
974 ipv4:
975 server_addresses:
976 - address: '73.1.1.1'
977 circuit_id: '%h:%p'
978 state: overridden
979
980 # After state:
981 # ------------
982 #
983 # sonic# show running-configuration interface
984 # !
985 # interface Eth1/1
986 # mtu 9100
987 # speed 400000
988 # fec RS
989 # no shutdown
990 # ip address 81.1.1.1/24
991 # ip dhcp-relay 91.1.1.1 93.1.1.1 95.1.1.1 vrf VrfReg1
992 # ip dhcp-relay vrf-select
993 # ipv6 address 81::1/24
994 # ipv6 dhcp-relay 93::1 94::1
995 # ipv6 dhcp-relay source-interface Vlan100
996 # !
997 # interface Eth1/2
998 # mtu 9100
999 # speed 400000
1000 # fec RS
1001 # no shutdown
1002 # ip address 61.1.1.1/24
1003 # ip dhcp-relay 73.1.1.1
1004 # ip dhcp-relay circuit-id %h:%p
1005 # ipv6 address 61::1/24
1006 # !
1007 # interface Eth1/3
1008 # mtu 9100
1009 # speed 400000
1010 # fec RS
1011 # shutdown
1012 # ip address 41.1.1.1/24
1013 # ipv6 address 41::1/24
1014 # !
1015
1016
1017
1018 Return Values
1019 -------------
1020 Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
1021
1022 .. raw:: html
1023
1024 <table border=0 cellpadding=0 class="documentation-table">
1025 <tr>
1026 <th colspan="1">Key</th>
1027 <th>Returned</th>
1028 <th width="100%">Description</th>
1029 </tr>
1030 <tr>
1031 <td colspan="1">
1032 <div class="ansibleOptionAnchor" id="return-"></div>
1033 <b>after</b>
1034 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1035 <div style="font-size: small">
1036 <span style="color: purple">list</span>
1037 </div>
1038 </td>
1039 <td>when changed</td>
1040 <td>
1041 <div>The resulting configuration module invocation.</div>
1042 <br/>
1043 <div style="font-size: smaller"><b>Sample:</b></div>
1044 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
1045 </td>
1046 </tr>
1047 <tr>
1048 <td colspan="1">
1049 <div class="ansibleOptionAnchor" id="return-"></div>
1050 <b>after_generated</b>
1051 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1052 <div style="font-size: small">
1053 <span style="color: purple">list</span>
1054 </div>
1055 </td>
1056 <td>when <code>check_mode</code></td>
1057 <td>
1058 <div>The generated configuration module invocation.</div>
1059 <br/>
1060 <div style="font-size: smaller"><b>Sample:</b></div>
1061 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
1062 </td>
1063 </tr>
1064 <tr>
1065 <td colspan="1">
1066 <div class="ansibleOptionAnchor" id="return-"></div>
1067 <b>before</b>
1068 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1069 <div style="font-size: small">
1070 <span style="color: purple">list</span>
1071 </div>
1072 </td>
1073 <td>always</td>
1074 <td>
1075 <div>The configuration prior to the module invocation.</div>
1076 <br/>
1077 <div style="font-size: smaller"><b>Sample:</b></div>
1078 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
1079 </td>
1080 </tr>
1081 <tr>
1082 <td colspan="1">
1083 <div class="ansibleOptionAnchor" id="return-"></div>
1084 <b>commands</b>
1085 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1086 <div style="font-size: small">
1087 <span style="color: purple">list</span>
1088 </div>
1089 </td>
1090 <td>always</td>
1091 <td>
1092 <div>The set of commands pushed to the remote device.</div>
1093 <br/>
1094 <div style="font-size: smaller"><b>Sample:</b></div>
1095 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;command 1&#x27;, &#x27;command 2&#x27;, &#x27;command 3&#x27;]</div>
1096 </td>
1097 </tr>
1098 </table>
1099 <br/><br/>
1100
1101
1102 Status
1103 ------
1104
1105
1106 Authors
1107 ~~~~~~~
1108
1109 - Arun Saravanan Balachandran (@ArunSaravananBalachandran)