@ -86,8 +86,8 @@ options:
runnable_type :
runnable_type :
description :
description :
- vDirect runnable type .
- vDirect runnable type .
- May be ConfigurationTemplate , WorkflowTemplate or a Workflow .
required : true
required : true
choices : [ ' ConfigurationTemplate ' , ' Workflow ' , ' WorkflowTemplate ' ]
runnable_name :
runnable_name :
description :
description :
- vDirect runnable name to run .
- vDirect runnable name to run .
@ -99,7 +99,7 @@ options:
- Required if I ( runnable_type = Workflow ) .
- Required if I ( runnable_type = Workflow ) .
parameters :
parameters :
description :
description :
- Action parameters dictionary . In case of C onfigurationTemplate runnable type ,
- Action parameters dictionary . In case of C ( C onfigurationTemplate) runnable type ,
- the device connection details should always be passed as a parameter .
- the device connection details should always be passed as a parameter .
requirements :
requirements :
@ -143,15 +143,11 @@ WORKFLOW_CREATION_SUCCESS = 'Workflow created.'
WORKFLOW_ACTION_SUCCESS = ' Workflow action run completed. '
WORKFLOW_ACTION_SUCCESS = ' Workflow action run completed. '
meta_args = dict (
meta_args = dict (
vdirect_ip = dict (
vdirect_ip = dict ( required = True , fallback = ( env_fallback , [ ' VDIRECT_IP ' ] ) ) ,
required = True , fallback = ( env_fallback , [ ' VDIRECT_IP ' ] ) ,
vdirect_user = dict ( required = True , fallback = ( env_fallback , [ ' VDIRECT_USER ' ] ) ) ,
default = None ) ,
vdirect_user = dict (
required = True , fallback = ( env_fallback , [ ' VDIRECT_USER ' ] ) ,
default = None ) ,
vdirect_password = dict (
vdirect_password = dict (
required = True , fallback = ( env_fallback , [ ' VDIRECT_PASSWORD ' ] ) ,
required = True , fallback = ( env_fallback , [ ' VDIRECT_PASSWORD ' ] ) ,
default= None , no_log= True , type = ' str ' ) ,
no_log = True , type = ' str ' ) ,
vdirect_secondary_ip = dict (
vdirect_secondary_ip = dict (
required = False , fallback = ( env_fallback , [ ' VDIRECT_SECONDARY_IP ' ] ) ,
required = False , fallback = ( env_fallback , [ ' VDIRECT_SECONDARY_IP ' ] ) ,
default = None ) ,
default = None ) ,
@ -176,7 +172,7 @@ meta_args = dict(
runnable_type = dict (
runnable_type = dict (
required = True ,
required = True ,
choices = [ CONFIGURATION_TEMPLATE_RUNNABLE_TYPE , WORKFLOW_TEMPLATE_RUNNABLE_TYPE , WORKFLOW_RUNNABLE_TYPE ] ) ,
choices = [ CONFIGURATION_TEMPLATE_RUNNABLE_TYPE , WORKFLOW_TEMPLATE_RUNNABLE_TYPE , WORKFLOW_RUNNABLE_TYPE ] ) ,
runnable_name = dict ( required = True , default = None ),
runnable_name = dict ( required = True ),
action_name = dict ( required = False , default = None ) ,
action_name = dict ( required = False , default = None ) ,
parameters = dict ( required = False , type = ' dict ' , default = { } )
parameters = dict ( required = False , type = ' dict ' , default = { } )
)
)
@ -309,12 +305,12 @@ class VdirectRunnable(object):
def main ( ) :
def main ( ) :
if not HAS_REST_CLIENT :
raise ImportError ( " The python vdirect-client module is required " )
module = AnsibleModule ( argument_spec = meta_args ,
module = AnsibleModule ( argument_spec = meta_args ,
required_if = [ [ ' runnable_type ' , WORKFLOW_RUNNABLE_TYPE , [ ' action_name ' ] ] ] )
required_if = [ [ ' runnable_type ' , WORKFLOW_RUNNABLE_TYPE , [ ' action_name ' ] ] ] )
if not HAS_REST_CLIENT :
module . fail_json ( msg = " The python vdirect-client module is required " )
try :
try :
vdirect_runnable = VdirectRunnable ( module . params )
vdirect_runnable = VdirectRunnable ( module . params )
result = vdirect_runnable . run ( )
result = vdirect_runnable . run ( )