Skip to content

Commit 7fc5bd1

Browse files
authored
Merge pull request Juniper#418 from dgarros/dga-console-ssh
Add support for Console over SSH (finally)
2 parents 812a87f + 12835cb commit 7fc5bd1

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

module_utils/juniper_junos_common.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122

123123
# Constants
124124
# Minimum PyEZ version required by shared code.
125-
MIN_PYEZ_VERSION = "2.1.7"
125+
MIN_PYEZ_VERSION = "2.2.0"
126126
# Installation URL for PyEZ.
127127
PYEZ_INSTALLATION_URL = "https://github.com/Juniper/py-junos-eznc#installation"
128128
# Minimum lxml version required by shared code.
@@ -332,6 +332,24 @@ class ModuleDocFragment(object):
332332
type: str
333333
aliases:
334334
- username
335+
cs_user:
336+
description:
337+
- The username used to authenticate with the console server over SSH.
338+
This option is only required if you want to connect to a device over console
339+
using SSH as transport. Mutually exclusive with the I(console) option.
340+
required: false
341+
type: str
342+
aliases:
343+
- console_username
344+
cs_passwd:
345+
description:
346+
- The password used to authenticate with the console server over SSH.
347+
This option is only required if you want to connect to a device over console
348+
using SSH as transport. Mutually exclusive with the I(console) option.
349+
required: false
350+
type: str
351+
aliases:
352+
- console_password
335353
'''
336354

337355
LOGGING_DOCUMENTATION = '''
@@ -475,6 +493,15 @@ class ModuleDocFragment(object):
475493
# Default behavior coded in JuniperJunosActionModule.run()
476494
default=None,
477495
no_log=True),
496+
'cs_user': dict(type='str',
497+
aliases=['console_username'],
498+
required=False,
499+
default=None),
500+
'cs_passwd': dict(type='str',
501+
aliases=['console_password'],
502+
required=False,
503+
default=None,
504+
no_log=True),
478505
'ssh_private_key_file': dict(type='path',
479506
required=False,
480507
aliases=['ssh_keyfile'],
@@ -513,7 +540,9 @@ class ModuleDocFragment(object):
513540
connection_spec_mutually_exclusive = [['mode', 'console'],
514541
['port', 'console'],
515542
['baud', 'console'],
516-
['attempts','console']]
543+
['attempts','console'],
544+
['cs_user', 'console'],
545+
['cs_passwd', 'console']]
517546
# Keys are connection options. Values are a list of task_vars to use as the
518547
# default value. Order of values specified against each key represents the
519548
# preference order of options in the key. Has to be maintained consistent with
@@ -1308,6 +1337,9 @@ def open(self):
13081337
self.close()
13091338
log_connect_args = dict(connect_args)
13101339
log_connect_args['passwd'] = 'NOT_LOGGING_PARAMETER'
1340+
if 'cs_passwd' in log_connect_args:
1341+
log_connect_args['cs_passwd'] = 'NOT_LOGGING_PARAMETER'
1342+
13111343
self.logger.debug("Creating device parameters: %s",
13121344
log_connect_args)
13131345
timeout = connect_args.pop('timeout')

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ ansible
22
jsnapy==1.3.2
33
jxmlease
44
docker
5-
junos-netconify
5+
junos-netconify

0 commit comments

Comments
 (0)