mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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):
|
||||
command = 'show run | inc ntp.(server|peer)'
|
||||
ntp_peer_list = []
|
||||
ntp = execute_show_command(
|
||||
response = execute_show_command(
|
||||
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\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*)?"
|
||||
|
@ -424,4 +428,3 @@ def main():
|
|||
from ansible.module_utils.basic import *
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
Loading…
Reference in a new issue