mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
adds feature to try to auto determine network_os (#18674)
This updates the network_cli connection plugin to attempt to automatically determine the remote device os. The device network os discovery can be overridden by setting the ansible_network_os value.
This commit is contained in:
parent
6fe9a5e40c
commit
8137c7207d
8 changed files with 56 additions and 7 deletions
|
@ -45,3 +45,9 @@ class TerminalModule(TerminalBase):
|
|||
except AnsibleConnectionFailure:
|
||||
raise AnsibleConnectionFailure('unable to set terminal parameters')
|
||||
|
||||
@staticmethod
|
||||
def guess_network_os(conn):
|
||||
stdin, stdout, stderr = conn.exec_command('show version')
|
||||
if 'Junos' in stdout.read():
|
||||
return 'junos'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue