From a4fc3def45320e633a773f2efa453c78d3b4afca Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 19 Jan 2022 18:19:45 -0500 Subject: Enable configuring ntp server pool in ntp_global (#225) Enable configuring ntp server pool in ntp_global Signed-off-by: GomathiselviS gomathiselvi@gmail.com SUMMARY Fixes #221 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Shawn Wilsher Reviewed-by: None --- README.md | 1 - changelogs/fragments/ntp_server_add_pool.yaml | 3 +++ docs/vyos.vyos.vyos_ntp_global_module.rst | 5 ++++- plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py | 1 + plugins/module_utils/network/vyos/rm_templates/ntp_global.py | 2 +- plugins/modules/vyos_ntp_global.py | 5 ++++- requirements.txt | 2 +- tests/unit/modules/network/vyos/test_vyos_ntp_global.py | 4 ++-- 8 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 changelogs/fragments/ntp_server_add_pool.yaml diff --git a/README.md b/README.md index 89640154..67e7a3b5 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,6 @@ Name | Description [vyos.vyos.vyos_ping](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_ping_module.rst)|Tests reachability using ping from VyOS network devices [vyos.vyos.vyos_prefix_lists](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_prefix_lists_module.rst)|Prefix-Lists resource module for VyOS [vyos.vyos.vyos_route_maps](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_route_maps_module.rst)|Route Map Resource Module. -[vyos.vyos.vyos_snmp_serve](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_snmp_serve_module.rst)|Manages snmp_server resource module [vyos.vyos.vyos_static_route](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_static_route_module.rst)|(deprecated, removed after 2022-06-01) Manage static IP routes on Vyatta VyOS network devices [vyos.vyos.vyos_static_routes](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_static_routes_module.rst)|Static routes resource module [vyos.vyos.vyos_system](https://github.com/ansible-collections/vyos.vyos/blob/main/docs/vyos.vyos.vyos_system_module.rst)|Run `set system` commands on VyOS devices diff --git a/changelogs/fragments/ntp_server_add_pool.yaml b/changelogs/fragments/ntp_server_add_pool.yaml new file mode 100644 index 00000000..a6c2b484 --- /dev/null +++ b/changelogs/fragments/ntp_server_add_pool.yaml @@ -0,0 +1,3 @@ +--- +major_changes: + - Add 'pool' as value to server key in ntp_global. diff --git a/docs/vyos.vyos.vyos_ntp_global_module.rst b/docs/vyos.vyos.vyos_ntp_global_module.rst index 7f27493c..18f0ece8 100644 --- a/docs/vyos.vyos.vyos_ntp_global_module.rst +++ b/docs/vyos.vyos.vyos_ntp_global_module.rst @@ -117,6 +117,7 @@ Parameters
  • dynamic
  • preempt
  • prefer
  • +
  • pool
  • @@ -749,7 +750,7 @@ Examples # # Task # # ------------- - - name: Gather ntp config + - name: Render ntp config vyos.vyos.vyos_ntp_global: config: allow_clients: @@ -764,6 +765,7 @@ Examples options: - noselect - prefer + - pool - server: time1.vyos.net - server: time2.vyos.net @@ -782,6 +784,7 @@ Examples # "set system ntp server server7", # "set system ntp server server45 noselect", # "set system ntp server server45 prefer", + # "set system ntp server server45 pool", # "set system ntp server time1.vyos.net", # "set system ntp server time2.vyos.net", # "set system ntp server time3.vyos.net" diff --git a/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py b/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py index 63262154..7ace5bb7 100644 --- a/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py +++ b/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py @@ -47,6 +47,7 @@ class Ntp_globalArgs(object): # pylint: disable=R0903 "choices": [ "noselect", "dynamic", + "pool", "preempt", "prefer", ], diff --git a/plugins/module_utils/network/vyos/rm_templates/ntp_global.py b/plugins/module_utils/network/vyos/rm_templates/ntp_global.py index ac0bcbbf..f4589a29 100644 --- a/plugins/module_utils/network/vyos/rm_templates/ntp_global.py +++ b/plugins/module_utils/network/vyos/rm_templates/ntp_global.py @@ -112,7 +112,7 @@ class NtpTemplate(NetworkTemplate): r""" ^set\ssystem\sntp\sserver \s(?P\S+) - \s(?Pnoselect|dynamic|preempt|prefer)? + \s(?Pnoselect|dynamic|pool|preempt|prefer)? $""", re.VERBOSE), "setval": "system ntp server {{server}} {{options}}", diff --git a/plugins/modules/vyos_ntp_global.py b/plugins/modules/vyos_ntp_global.py index 6686aa41..d06d8788 100644 --- a/plugins/modules/vyos_ntp_global.py +++ b/plugins/modules/vyos_ntp_global.py @@ -51,6 +51,7 @@ DOCUMENTATION = """ choices: - noselect - dynamic + - pool - preempt - prefer running_config: @@ -627,7 +628,7 @@ EXAMPLES = """ # # Task # # ------------- -- name: Gather ntp config +- name: Render ntp config vyos.vyos.vyos_ntp_global: config: allow_clients: @@ -642,6 +643,7 @@ EXAMPLES = """ options: - noselect - prefer + - pool - server: time1.vyos.net - server: time2.vyos.net @@ -660,6 +662,7 @@ EXAMPLES = """ # "set system ntp server server7", # "set system ntp server server45 noselect", # "set system ntp server server45 prefer", +# "set system ntp server server45 pool", # "set system ntp server time1.vyos.net", # "set system ntp server time2.vyos.net", # "set system ntp server time3.vyos.net" diff --git a/requirements.txt b/requirements.txt index e98b9313..8c44c98f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ ansible-pylibssh -paramiko +paramiko==2.8.1 diff --git a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py index c27704f9..53dabdcd 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py @@ -104,7 +104,7 @@ class TestVyosNTPModule(TestVyosModule): server="server5", options=[ "noselect", - "dynamic", + "pool", "preempt", "prefer", ], @@ -122,7 +122,7 @@ class TestVyosNTPModule(TestVyosModule): "set system ntp listen-address 10.4.5.1", "set system ntp server server4 dynamic", "set system ntp server server4 preempt", - "set system ntp server server5 dynamic", + "set system ntp server server5 pool", "set system ntp server server5 noselect", "set system ntp server server5 preempt", "set system ntp server server5 prefer", -- cgit v1.2.3