Need some advice on module syntax
I want to do this:
cl_interface name=br0 bridgemems=(list of bridge ports) ipv4=‘10.1.1.1/24’
cl_interface name=bond0 bondmems=(list of bond members) ipv4=‘10.2.2.2/24’
the bondmems and bridgemems keywords are mutually exclusive.
Question: Can AnsibleModule handle this mutual exclusive condition, like I can with ‘docopt’. With docopt I can say ‘cl_interface [(–bridgemems | --bondmems)] [–ipv4]’.
If not, I guess I have to code this logic and execute AnsibleModule.fail_json to warn the user.
Or, is it better to write
cl_bridge name=br0 bridgemems=(list of bridges ports) ipv4=2.2.2.2/24
cl_bond name=br0 bondmems=(list of bonds) ipv4=1.1.1.1/24
I do prefer to use just ‘cl_interface’ keyword, because I can cover all types of switch interfaces, i.e bond, bridges, loopbacks, and management ports with one module.
Thanks in advance for your help
Stanley K.