summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGomathiselviS <gomathiselvi@gmail.com>2022-01-19 18:19:45 -0500
committerGitHub <noreply@github.com>2022-01-19 23:19:45 +0000
commita4fc3def45320e633a773f2efa453c78d3b4afca (patch)
tree641aa4561fdb891513979d7794db888685209178
parentbe096e94d2904dd5743abde26253b86fa79f26bb (diff)
downloadvyos.vyos-a4fc3def45320e633a773f2efa453c78d3b4afca.tar.gz
vyos.vyos-a4fc3def45320e633a773f2efa453c78d3b4afca.zip
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 <None> Reviewed-by: None <None>
-rw-r--r--README.md1
-rw-r--r--changelogs/fragments/ntp_server_add_pool.yaml3
-rw-r--r--docs/vyos.vyos.vyos_ntp_global_module.rst5
-rw-r--r--plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py1
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/ntp_global.py2
-rw-r--r--plugins/modules/vyos_ntp_global.py5
-rw-r--r--requirements.txt2
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_ntp_global.py4
8 files changed, 16 insertions, 7 deletions
diff --git a/README.md b/README.md
index 8964015..67e7a3b 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 0000000..a6c2b48
--- /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 7f27493..18f0ece 100644
--- a/docs/vyos.vyos.vyos_ntp_global_module.rst
+++ b/docs/vyos.vyos.vyos_ntp_global_module.rst
@@ -117,6 +117,7 @@ Parameters
<li>dynamic</li>
<li>preempt</li>
<li>prefer</li>
+ <li>pool</li>
</ul>
</td>
<td>
@@ -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 6326215..7ace5bb 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 ac0bcbb..f4589a2 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<name>\S+)
- \s(?P<options>noselect|dynamic|preempt|prefer)?
+ \s(?P<options>noselect|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 6686aa4..d06d878 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 e98b931..8c44c98 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 c27704f..53dabdc 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",