Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_ntp_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_ntp_module:
2
3
4 **********************************
5 dellemc.enterprise_sonic.sonic_ntp
6 **********************************
7
8 **Manage NTP configuration on SONiC.**
9
10
11 Version added: 2.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides configuration management of NTP for devices running SONiC.
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="3">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="3">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>config</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">dictionary</span>
43 </div>
44 </td>
45 <td>
46 </td>
47 <td>
48 <div>Specifies NTP related configurations.</div>
49 </td>
50 </tr>
51 <tr>
52 <td class="elbow-placeholder"></td>
53 <td colspan="2">
54 <div class="ansibleOptionAnchor" id="parameter-"></div>
55 <b>enable_ntp_auth</b>
56 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
57 <div style="font-size: small">
58 <span style="color: purple">boolean</span>
59 </div>
60 </td>
61 <td>
62 <ul style="margin: 0; padding: 0"><b>Choices:</b>
63 <li>no</li>
64 <li>yes</li>
65 </ul>
66 </td>
67 <td>
68 <div>Enable or disable NTP authentication.</div>
69 </td>
70 </tr>
71 <tr>
72 <td class="elbow-placeholder"></td>
73 <td colspan="2">
74 <div class="ansibleOptionAnchor" id="parameter-"></div>
75 <b>ntp_keys</b>
76 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
77 <div style="font-size: small">
78 <span style="color: purple">list</span>
79 / <span style="color: purple">elements=dictionary</span>
80 </div>
81 </td>
82 <td>
83 </td>
84 <td>
85 <div>List of NTP authentication keys.</div>
86 </td>
87 </tr>
88 <tr>
89 <td class="elbow-placeholder"></td>
90 <td class="elbow-placeholder"></td>
91 <td colspan="1">
92 <div class="ansibleOptionAnchor" id="parameter-"></div>
93 <b>encrypted</b>
94 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
95 <div style="font-size: small">
96 <span style="color: purple">boolean</span>
97 </div>
98 </td>
99 <td>
100 <ul style="margin: 0; padding: 0"><b>Choices:</b>
101 <li>no</li>
102 <li>yes</li>
103 </ul>
104 </td>
105 <td>
106 <div>NTP authentication key_value is encrypted.</div>
107 <div>encrypted can not be deleted.</div>
108 <div>When &quot;state&quot; is &quot;merged&quot;, &quot;encrypted&quot; is required.</div>
109 </td>
110 </tr>
111 <tr>
112 <td class="elbow-placeholder"></td>
113 <td class="elbow-placeholder"></td>
114 <td colspan="1">
115 <div class="ansibleOptionAnchor" id="parameter-"></div>
116 <b>key_id</b>
117 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
118 <div style="font-size: small">
119 <span style="color: purple">integer</span>
120 / <span style="color: red">required</span>
121 </div>
122 </td>
123 <td>
124 </td>
125 <td>
126 <div>NTP authentication key identifier.</div>
127 </td>
128 </tr>
129 <tr>
130 <td class="elbow-placeholder"></td>
131 <td class="elbow-placeholder"></td>
132 <td colspan="1">
133 <div class="ansibleOptionAnchor" id="parameter-"></div>
134 <b>key_type</b>
135 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
136 <div style="font-size: small">
137 <span style="color: purple">string</span>
138 </div>
139 </td>
140 <td>
141 <ul style="margin: 0; padding: 0"><b>Choices:</b>
142 <li>NTP_AUTH_SHA1</li>
143 <li>NTP_AUTH_MD5</li>
144 <li>NTP_AUTH_SHA2_256</li>
145 </ul>
146 </td>
147 <td>
148 <div>NTP authentication key type.</div>
149 <div>key_type can not be deleted.</div>
150 <div>When &quot;state&quot; is &quot;merged&quot;, &quot;key_type&quot; is required.</div>
151 </td>
152 </tr>
153 <tr>
154 <td class="elbow-placeholder"></td>
155 <td class="elbow-placeholder"></td>
156 <td colspan="1">
157 <div class="ansibleOptionAnchor" id="parameter-"></div>
158 <b>key_value</b>
159 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
160 <div style="font-size: small">
161 <span style="color: purple">string</span>
162 </div>
163 </td>
164 <td>
165 </td>
166 <td>
167 <div>NTP authentication key value.</div>
168 <div>key_value can not be deleted.</div>
169 <div>When &quot;state&quot; is &quot;merged&quot;, &quot;key_value&quot; is required.</div>
170 </td>
171 </tr>
172
173 <tr>
174 <td class="elbow-placeholder"></td>
175 <td colspan="2">
176 <div class="ansibleOptionAnchor" id="parameter-"></div>
177 <b>servers</b>
178 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
179 <div style="font-size: small">
180 <span style="color: purple">list</span>
181 / <span style="color: purple">elements=dictionary</span>
182 </div>
183 </td>
184 <td>
185 </td>
186 <td>
187 <div>List of NTP servers.</div>
188 <div>minpoll and maxpoll are required to be configured together.</div>
189 </td>
190 </tr>
191 <tr>
192 <td class="elbow-placeholder"></td>
193 <td class="elbow-placeholder"></td>
194 <td colspan="1">
195 <div class="ansibleOptionAnchor" id="parameter-"></div>
196 <b>address</b>
197 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
198 <div style="font-size: small">
199 <span style="color: purple">string</span>
200 / <span style="color: red">required</span>
201 </div>
202 </td>
203 <td>
204 </td>
205 <td>
206 <div>IPv4/IPv6 address or host name of NTP server.</div>
207 </td>
208 </tr>
209 <tr>
210 <td class="elbow-placeholder"></td>
211 <td class="elbow-placeholder"></td>
212 <td colspan="1">
213 <div class="ansibleOptionAnchor" id="parameter-"></div>
214 <b>key_id</b>
215 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
216 <div style="font-size: small">
217 <span style="color: purple">integer</span>
218 </div>
219 </td>
220 <td>
221 </td>
222 <td>
223 <div>NTP authentication key used by server.</div>
224 <div>Key_id can not be deleted.</div>
225 </td>
226 </tr>
227 <tr>
228 <td class="elbow-placeholder"></td>
229 <td class="elbow-placeholder"></td>
230 <td colspan="1">
231 <div class="ansibleOptionAnchor" id="parameter-"></div>
232 <b>maxpoll</b>
233 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
234 <div style="font-size: small">
235 <span style="color: purple">integer</span>
236 </div>
237 </td>
238 <td>
239 </td>
240 <td>
241 <div>Maximum poll interval to poll NTP server.</div>
242 <div>maxpoll can not be deleted.</div>
243 </td>
244 </tr>
245 <tr>
246 <td class="elbow-placeholder"></td>
247 <td class="elbow-placeholder"></td>
248 <td colspan="1">
249 <div class="ansibleOptionAnchor" id="parameter-"></div>
250 <b>minpoll</b>
251 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
252 <div style="font-size: small">
253 <span style="color: purple">integer</span>
254 </div>
255 </td>
256 <td>
257 </td>
258 <td>
259 <div>Minimum poll interval to poll NTP server.</div>
260 <div>minpoll can not be deleted.</div>
261 </td>
262 </tr>
263 <tr>
264 <td class="elbow-placeholder"></td>
265 <td class="elbow-placeholder"></td>
266 <td colspan="1">
267 <div class="ansibleOptionAnchor" id="parameter-"></div>
268 <b>prefer</b>
269 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
270 <div style="font-size: small">
271 <span style="color: purple">boolean</span>
272 </div>
273 </td>
274 <td>
275 <ul style="margin: 0; padding: 0"><b>Choices:</b>
276 <li>no</li>
277 <li>yes</li>
278 </ul>
279 </td>
280 <td>
281 <div>Indicates whether this server should be preferred.</div>
282 <div>prefer can not be deleted.</div>
283 </td>
284 </tr>
285
286 <tr>
287 <td class="elbow-placeholder"></td>
288 <td colspan="2">
289 <div class="ansibleOptionAnchor" id="parameter-"></div>
290 <b>source_interfaces</b>
291 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
292 <div style="font-size: small">
293 <span style="color: purple">list</span>
294 / <span style="color: purple">elements=string</span>
295 </div>
296 </td>
297 <td>
298 </td>
299 <td>
300 <div>List of names of NTP source interfaces.</div>
301 </td>
302 </tr>
303 <tr>
304 <td class="elbow-placeholder"></td>
305 <td colspan="2">
306 <div class="ansibleOptionAnchor" id="parameter-"></div>
307 <b>trusted_keys</b>
308 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
309 <div style="font-size: small">
310 <span style="color: purple">list</span>
311 / <span style="color: purple">elements=integer</span>
312 </div>
313 </td>
314 <td>
315 </td>
316 <td>
317 <div>List of trusted NTP authentication keys.</div>
318 </td>
319 </tr>
320 <tr>
321 <td class="elbow-placeholder"></td>
322 <td colspan="2">
323 <div class="ansibleOptionAnchor" id="parameter-"></div>
324 <b>vrf</b>
325 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
326 <div style="font-size: small">
327 <span style="color: purple">string</span>
328 </div>
329 </td>
330 <td>
331 </td>
332 <td>
333 <div>VRF name on which NTP is enabled.</div>
334 </td>
335 </tr>
336
337 <tr>
338 <td colspan="3">
339 <div class="ansibleOptionAnchor" id="parameter-"></div>
340 <b>state</b>
341 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
342 <div style="font-size: small">
343 <span style="color: purple">string</span>
344 </div>
345 </td>
346 <td>
347 <ul style="margin: 0; padding: 0"><b>Choices:</b>
348 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
349 <li>replaced</li>
350 <li>overridden</li>
351 <li>deleted</li>
352 </ul>
353 </td>
354 <td>
355 <div>The state of the configuration after module completion.</div>
356 </td>
357 </tr>
358 </table>
359 <br/>
360
361
362 Notes
363 -----
364
365 .. note::
366 - Supports ``check_mode``.
367
368
369
370 Examples
371 --------
372
373 .. code-block:: yaml
374
375 # Using "deleted" state
376 #
377 # Before state:
378 # -------------
379 #
380 # sonic# show ntp server
381 # ----------------------------------------------------------------------------
382 # NTP Servers minpoll maxpoll Prefer Authentication key ID
383 # ----------------------------------------------------------------------------
384 # 10.11.0.1 6 10 False
385 # 10.11.0.2 5 9 False
386 # dell.com 6 9 False
387 # dell.org 7 10 True
388 #
389 - name: Delete NTP server configuration
390 sonic_ntp:
391 config:
392 servers:
393 - address: 10.11.0.2
394 - address: dell.org
395 state: deleted
396
397 # After state:
398 # ------------
399 #
400 # sonic# show ntp server
401 # ----------------------------------------------------------------------------
402 # NTP Servers minpoll maxpoll Prefer Authentication key ID
403 # ----------------------------------------------------------------------------
404 # 10.11.0.1 6 10 False
405 # dell.com 6 9 False
406 #
407 #
408 # Using "deleted" state
409 #
410 # Before state:
411 # -------------
412 #
413 # sonic# show ntp global
414 # ----------------------------------------------
415 # NTP Global Configuration
416 # ----------------------------------------------
417 # NTP source-interfaces: Ethernet0, Ethernet4, Ethernet8, Ethernet16
418 #
419 - name: Delete NTP source-interface configuration
420 sonic_ntp:
421 config:
422 source_interfaces:
423 - Ethernet8
424 - Ethernet16
425 state: deleted
426
427 # After state:
428 # ------------
429 #
430 # sonic# show ntp global
431 # ----------------------------------------------
432 # NTP Global Configuration
433 # ----------------------------------------------
434 # NTP source-interfaces: Ethernet0, Ethernet4
435 #
436 #
437 # Using "deleted" state
438 #
439 # Before state:
440 # -------------
441 #
442 # sonic# show running-configuration | grep ntp
443 # ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
444 # ntp authentication-key 10 md5 U2FsdGVkX1/Gxds/5pscCvIKbVngGaKka4SQineS51Y= encrypted
445 # ntp authentication-key 20 sha2-256 U2FsdGVkX1/eAzKj1teKhYWD7tnzOsYOijGeFAT0rKM= encrypted
446 #
447 - name: Delete NTP key configuration
448 sonic_ntp:
449 config:
450 ntp_keys:
451 - key_id: 10
452 - key_id: 20
453 state: deleted
454 #
455 # After state:
456 # ------------
457 #
458 # sonic# show running-configuration | grep ntp
459 # ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
460 #
461 #
462 # Using "merged" state
463 #
464 # Before state:
465 # -------------
466 #
467 # sonic# show ntp server
468 # ----------------------------------------------------------------------------
469 # NTP Servers minpoll maxpoll Prefer Authentication key ID
470 # ----------------------------------------------------------------------------
471 # 10.11.0.1 6 10 False
472 # dell.com 6 9 False
473 #
474 - name: Merge NTP server configuration
475 sonic_ntp:
476 config:
477 servers:
478 - address: 10.11.0.2
479 minpoll: 5
480 - address: dell.org
481 minpoll: 7
482 maxpoll: 10
483 prefer: true
484 state: merged
485
486 # After state:
487 # ------------
488 #
489 # sonic# show ntp server
490 # ----------------------------------------------------------------------------
491 # NTP Servers minpoll maxpoll Prefer Authentication key ID
492 # ----------------------------------------------------------------------------
493 # 10.11.0.1 6 10 Flase
494 # 10.11.0.2 5 10 Flase
495 # dell.com 6 9 Flase
496 # dell.org 7 10 True
497 #
498 #
499 # Using "merged" state
500 #
501 # Before state:
502 # -------------
503 #
504 # sonic# show ntp global
505 # ----------------------------------------------
506 # NTP Global Configuration
507 # ----------------------------------------------
508 # NTP source-interfaces: Ethernet0, Ethernet4
509 #
510 - name: Merge NTP source-interface configuration
511 sonic_ntp:
512 config:
513 source_interfaces:
514 - Ethernet8
515 - Ethernet16
516 state: merged
517
518 # After state:
519 # ------------
520 #
521 # sonic# show ntp global
522 # ----------------------------------------------
523 # NTP Global Configuration
524 # ----------------------------------------------
525 # NTP source-interfaces: Ethernet0, Ethernet4, Ethernet8, Ethernet16
526 #
527 #
528 # Using "merged" state
529 #
530 # Before state:
531 # -------------
532 #
533 # sonic# show running-configuration | grep ntp
534 # ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
535 #
536 - name: Merge NTP key configuration
537 sonic_ntp:
538 config:
539 ntp_keys:
540 - key_id: 10
541 key_type: NTP_AUTH_MD5
542 key_value: dellemc10
543 encrypted: false
544 - key_id: 20
545 key_type: NTP_AUTH_SHA2_256
546 key_value: dellemc20
547 encrypted: false
548 state: merged
549 #
550 # After state:
551 # ------------
552 #
553 # sonic# show running-configuration | grep ntp
554 # ntp authentication-key 8 sha1 U2FsdGVkX1/NpJrdOeyMeUHEkSohY6azY9VwbAqXRTY= encrypted
555 # ntp authentication-key 10 md5 U2FsdGVkX1/Gxds/5pscCvIKbVngGaKka4SQineS51Y= encrypted
556 # ntp authentication-key 20 sha2-256 U2FsdGVkX1/eAzKj1teKhYWD7tnzOsYOijGeFAT0rKM= encrypted
557 #
558 # Using "replaced" state
559 #
560 # Before state:
561 # -------------
562 #
563 # sonic# show ntp server
564 # ----------------------------------------------------------------------------
565 # NTP Servers minpoll maxpoll Prefer Authentication key ID
566 # ----------------------------------------------------------------------------
567 # 10.11.0.1 6 10 False
568 # dell.com 6 9 False
569 #
570 - name: Replace NTP server configuration
571 sonic_ntp:
572 config:
573 servers:
574 - address: 10.11.0.2
575 minpoll: 5
576 maxpoll: 9
577 - address: dell.com
578 minpoll: 7
579 maxpoll: 10
580 prefer: true
581 state: replaced
582 #
583 # After state:
584 # ------------
585 #
586 # sonic# show ntp server
587 # ----------------------------------------------------------------------------
588 # NTP Servers minpoll maxpoll Prefer Authentication key ID
589 # ----------------------------------------------------------------------------
590 # 10.11.0.1 6 10 False
591 # 10.11.0.2 5 9 False
592 # dell.com 7 10 True
593 #
594 # Using "overridden" state
595 #
596 # Before state:
597 # -------------
598 #
599 # sonic# show ntp server
600 # ----------------------------------------------------------------------------
601 # NTP Servers minpoll maxpoll Prefer Authentication key ID
602 # ----------------------------------------------------------------------------
603 # 10.11.0.1 6 10 False
604 # dell.com 6 9 False
605 #
606 # sonic# show ntp global
607 # ----------------------------------------------
608 # NTP Global Configuration
609 # ----------------------------------------------
610 # NTP source-interfaces: Ethernet0, Ethernet4
611 #
612 - name: Overridden NTP configuration
613 sonic_ntp:
614 config:
615 servers:
616 - address: 10.11.0.2
617 minpoll: 5
618 - address: dell.com
619 minpoll: 7
620 maxpoll: 10
621 prefer: true
622 state: overridden
623 #
624 # After state:
625 # ------------
626 #
627 # After state:
628 # ------------
629 #
630 # sonic# show ntp server
631 # ----------------------------------------------------------------------------
632 # NTP Servers minpoll maxpoll Prefer Authentication key ID
633 # ----------------------------------------------------------------------------
634 # 10.11.0.2 5 10 False
635 # dell.com 7 10 True
636 #
637 # sonic# show ntp global
638 #
639
640
641
642 Return Values
643 -------------
644 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:
645
646 .. raw:: html
647
648 <table border=0 cellpadding=0 class="documentation-table">
649 <tr>
650 <th colspan="1">Key</th>
651 <th>Returned</th>
652 <th width="100%">Description</th>
653 </tr>
654 <tr>
655 <td colspan="1">
656 <div class="ansibleOptionAnchor" id="return-"></div>
657 <b>after</b>
658 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
659 <div style="font-size: small">
660 <span style="color: purple">list</span>
661 </div>
662 </td>
663 <td>when changed</td>
664 <td>
665 <div>The resulting configuration module invocation.</div>
666 <br/>
667 <div style="font-size: smaller"><b>Sample:</b></div>
668 <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>
669 </td>
670 </tr>
671 <tr>
672 <td colspan="1">
673 <div class="ansibleOptionAnchor" id="return-"></div>
674 <b>after_generated</b>
675 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
676 <div style="font-size: small">
677 <span style="color: purple">list</span>
678 </div>
679 </td>
680 <td>when <code>check_mode</code></td>
681 <td>
682 <div>The generated configuration module invocation.</div>
683 <br/>
684 <div style="font-size: smaller"><b>Sample:</b></div>
685 <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>
686 </td>
687 </tr>
688 <tr>
689 <td colspan="1">
690 <div class="ansibleOptionAnchor" id="return-"></div>
691 <b>before</b>
692 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
693 <div style="font-size: small">
694 <span style="color: purple">list</span>
695 </div>
696 </td>
697 <td>always</td>
698 <td>
699 <div>The configuration prior to the module invocation.</div>
700 <br/>
701 <div style="font-size: smaller"><b>Sample:</b></div>
702 <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>
703 </td>
704 </tr>
705 <tr>
706 <td colspan="1">
707 <div class="ansibleOptionAnchor" id="return-"></div>
708 <b>commands</b>
709 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
710 <div style="font-size: small">
711 <span style="color: purple">list</span>
712 </div>
713 </td>
714 <td>always</td>
715 <td>
716 <div>The set of commands pushed to the remote device.</div>
717 <br/>
718 <div style="font-size: smaller"><b>Sample:</b></div>
719 <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>
720 </td>
721 </tr>
722 </table>
723 <br/><br/>
724
725
726 Status
727 ------
728
729
730 Authors
731 ~~~~~~~
732
733 - M\. Zhang (@mingjunzhang2019)