# Enforcing multiple parameters in a Module

**URL:** <https://forum.ansible.com/t/enforcing-multiple-parameters-in-a-module/24719>\
**Category:** Ansible Project\
**Created:** [June 14, 2017, 9:24am UTC](https://forum.ansible.com/t/enforcing-multiple-parameters-in-a-module/24719 "2017-06-14T09:24:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MKPhil](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@MKPhil](https://forum.ansible.com/u/MKPhil)\
**Post date:** [June 14, 2017, 9:24am UTC](https://forum.ansible.com/t/enforcing-multiple-parameters-in-a-module/24719/1 "2017-06-14T09:24:04Z")

</div>

I’m developing a Module and am trying to work out how to ensure my module gets the parameters it needs.

There are two separate parameters, lets call them A and B. My Module requires that either just A is supplied, or just B, or both A _and_ B - the only scenario that is not supported is no parameters so I want the module to error out at this stage. I can make a single parameter required by using the “required=True” flag in the argument\_spec but I can’t see how to achieve my desired result short of writing an “if” statement and throwing my own error message.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 14, 2017, 2:53pm UTC](https://forum.ansible.com/t/enforcing-multiple-parameters-in-a-module/24719/2 "2017-06-14T14:53:46Z")

</div>

ansible-devel is a better forum for this kind of question (both  
mailing list and IRC channel).
