@@ -289,6 +289,13 @@ class ModuleDocFragment(object):
289
289
type: path
290
290
aliases:
291
291
- ssh_keyfile
292
+ ssh_config:
293
+ description:
294
+ - The path to the SSH client configuration file. If this option is not
295
+ specified, then the PyEZ Device instance by default queries file
296
+ ~/.ssh/config.
297
+ required: false
298
+ type: path
292
299
timeout:
293
300
description:
294
301
- The maximum number of seconds to wait for RPC responses from the
@@ -332,7 +339,7 @@ class ModuleDocFragment(object):
332
339
- The log file must be writeable. If the file already exists, it is
333
340
appended. It is the users responsibility to delete/rotate log files.
334
341
- The level of information logged in this file is controlled by
335
- Ansible's verbosity and debug options
342
+ Ansible's verbosity, debug options and level option in task
336
343
- 1) By default, messages at level C(WARNING) or higher are logged.
337
344
- 2) If the C(-v) or C(--verbose) command-line options to the
338
345
C(ansible-playbook) command are specified, messages at level
@@ -341,6 +348,8 @@ class ModuleDocFragment(object):
341
348
C(ansible-playbook) command is specified, or the C(ANSIBLE_DEBUG)
342
349
environment variable is set, then messages at level C(DEBUG) or
343
350
higher are logged.
351
+ - 4) If C(level) is mentioned then messages at level C(level) or more are
352
+ logged.
344
353
- The I(logfile) and I(logdir) options are mutually exclusive. The
345
354
I(logdir) option is recommended for all new playbooks.
346
355
required: false
@@ -355,7 +364,7 @@ class ModuleDocFragment(object):
355
364
- The log file must be writeable. If the file already exists, it is
356
365
appended. It is the users responsibility to delete/rotate log files.
357
366
- The level of information logged in this file is controlled by
358
- Ansible's verbosity and debug options
367
+ Ansible's verbosity, debug options and level option in task
359
368
- 1) By default, messages at level C(WARNING) or higher are logged.
360
369
- 2) If the C(-v) or C(--verbose) command-line options to the
361
370
C(ansible-playbook) command are specified, messages at level
@@ -364,6 +373,8 @@ class ModuleDocFragment(object):
364
373
C(ansible-playbook) command is specified, or the C(ANSIBLE_DEBUG)
365
374
environment variable is set, then messages at level C(DEBUG) or
366
375
higher are logged.
376
+ - 4) If C(level) is mentioned then messages at level C(level) or more are
377
+ logged.
367
378
- When tasks are executed against more than one target host,
368
379
one process is forked for each target host. (Up to the maximum
369
380
specified by the forks configuration. See
@@ -381,6 +392,27 @@ class ModuleDocFragment(object):
381
392
type: path
382
393
aliases:
383
394
- log_file
395
+ level:
396
+ description:
397
+ - The level of information to be logged can be modified using this option
398
+ - 1) By default, messages at level C(WARNING) or higher are logged.
399
+ - 2) If the C(-v) or C(--verbose) command-line options to the
400
+ C(ansible-playbook) command are specified, messages at level
401
+ C(INFO) or higher are logged.
402
+ - 3) If the C(-vv) (or more verbose) command-line option to the
403
+ C(ansible-playbook) command is specified, or the C(ANSIBLE_DEBUG)
404
+ environment variable is set, then messages at level C(DEBUG) or
405
+ higher are logged.
406
+ - 4) If C(level) is mentioned then messages at level C(level) or more are
407
+ logged.
408
+ required: false
409
+ default: WARNING
410
+ type: str
411
+ choices:
412
+ - INFO
413
+ - DEBUG
414
+
415
+
384
416
'''
385
417
386
418
# _SUB_CONNECT_DOCUMENTATION is just _CONNECT_DOCUMENTATION with each
@@ -443,6 +475,9 @@ class ModuleDocFragment(object):
443
475
# Default behavior coded in
444
476
# JuniperJunosActionModule.run()
445
477
default = None ),
478
+ 'ssh_config' : dict (type = 'path' ,
479
+ required = False ,
480
+ default = None ),
446
481
'mode' : dict (choices = [None , 'telnet' , 'serial' ],
447
482
default = None ),
448
483
'console' : dict (type = 'str' ,
@@ -497,7 +532,8 @@ class ModuleDocFragment(object):
497
532
# Specify the logging spec.
498
533
logging_spec = {
499
534
'logfile' : dict (type = 'path' , required = False , default = None ),
500
- 'logdir' : dict (type = 'path' , required = False , default = None )
535
+ 'logdir' : dict (type = 'path' , required = False , default = None ),
536
+ 'level' : dict (choices = [None , 'INFO' , 'DEBUG' ], required = False , default = None )
501
537
}
502
538
503
539
# The logdir and logfile options are mutually exclusive.
@@ -874,6 +910,9 @@ def process(self, msg, kwargs):
874
910
level = logging .INFO
875
911
elif self ._verbosity > 1 :
876
912
level = logging .DEBUG
913
+ # Set level as mentioned in task
914
+ elif self .params .get ('level' ) is not None :
915
+ level = self .params .get ('level' )
877
916
# Get the logger object to be used for our logging.
878
917
logger = logging .getLogger ('jnpr.ansible_module.' + self .module_name )
879
918
# Attach the NullHandler to avoid any errors if no logging is needed.
0 commit comments