Hello! I’m currently developing a custom module to support a specific network OS. This module takes some custom arguments. The problem is that even though some of them are not required, when running a playbook Ansible still sees it as an error and fails the task.
What did I do wrong here? It seems to be the case only for arguments with the option “choices”, as if they were automatically seen as required, altough this is not the functionning I’m looking for.
Thanks for your help!
My playbook :
- name: Configure interfaces
custom.ers.ers_interfaces:
config:
- interfaces: 10-14
vlan: 100,200,300
pvid: 100
My argument specs:
self._argument_spec = {
"config": {
"elements": "dict",
"options": {
"interfaces": {"type": "str", "required": True},
"vlan": {"type": "str"},
"pvid": {"type": "str"},
"tagging": {"type": "str", "choices": ["untagall", "untagpvidonly", "tagall"]},
"shutdown": {"type": "str", "choices": ["enabled", "disabled"]},
"description": {"type": "str"}
},
"type": "list",
}
}