I have a custom Ansible module which takes protocol as a parameter and it is a mandatory parameter.
module_args = dict(
protocol=dict(type='str', required=True),
protocol_metadata=dict(type='dict', default={})
)
In the below task, if I don't pass any value in protocol my task is accepting it and setting the value as None in module. But I want my task not to accept None if I am not passing any value in protocol parameter. How to restrict the protocol param to not accept None?
tasks:
- name: log api request
my_module:
protocol:
protocol_metadata:
url: "{{ server }}{{ endpoint }}"