I want to create a Custom Module call API which will take
action:getorsearchresource:car/truck/plane/ship- optional parameters - dynamic parameter based on
actionandresource
For example if action is get and resource is car, then I want to add wheels, doors as module parameter.
module_args = {
'action': {'required': True, 'type': 'str', choice:['get','search']},
'resource': {'required': True, 'type': 'str', choice: ['car', 'truck', 'ship']},
}
module = AnsibleModule(argument_spec=module_args,
required_if('resource', 'car', ('wheels', 'doors'))
supports_check_mode=True
)
Is there a way to put required_if on two options i.e if action == 'search' and resource =='car' then use different set of arguments?