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:
Peter Sprygada 2016-11-30 16:28:47 -05:00 committed by GitHub
parent 6fe9a5e40c
commit 8137c7207d
8 changed files with 56 additions and 7 deletions

View file

@ -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'