mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
parent
0e0e5097a9
commit
78ed0cadea
1 changed files with 41 additions and 38 deletions
|
@ -180,11 +180,15 @@ def get_ntp_source(module):
|
||||||
def get_ntp_peer(module):
|
def get_ntp_peer(module):
|
||||||
command = 'show run | inc ntp.(server|peer)'
|
command = 'show run | inc ntp.(server|peer)'
|
||||||
ntp_peer_list = []
|
ntp_peer_list = []
|
||||||
ntp = execute_show_command(
|
response = execute_show_command(
|
||||||
command, module, command_type='cli_show_ascii')
|
command, module, command_type='cli_show_ascii')
|
||||||
if ntp:
|
|
||||||
ntp = ntp[0]
|
|
||||||
|
|
||||||
|
if response:
|
||||||
|
if isinstance(response, list):
|
||||||
|
ntp = response[0]
|
||||||
|
else:
|
||||||
|
ntp = response
|
||||||
|
if ntp:
|
||||||
ntp_regex = (
|
ntp_regex = (
|
||||||
".*ntp\s(server\s(?P<address>\S+)|peer\s(?P<peer_address>\S+))"
|
".*ntp\s(server\s(?P<address>\S+)|peer\s(?P<peer_address>\S+))"
|
||||||
"\s*((?P<prefer>prefer)\s*)?(use-vrf\s(?P<vrf_name>\S+)\s*)?"
|
"\s*((?P<prefer>prefer)\s*)?(use-vrf\s(?P<vrf_name>\S+)\s*)?"
|
||||||
|
@ -424,4 +428,3 @@ def main():
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue