I'm writing a custom module. I wanted to set some fields to 
"required": True, depending upon the previous field i.e if user specified 
previous field then next field should be set to required:True 
please see this below example  and help me!

def main():

  fields = {
        "name": {"required": True, "type": "str" },
        "description": {"required": False, "type": "str"},
        "storage": {"type": "str" },
        "capacity": { # Here it should become "required": True if and only if 
user specifies
 storage[in play.yml] else it should be "required":False},

    module = AnsibleModule(argument_spec=fields)
    module.exit_json(changed=False, meta=module.params)

You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to