Hi guys,

I maned be creating ansible module for generating name my resources a
cloud, but need before defined fields know this type of resource.
I wanna valid field type before declared other fields.

Ex.:
    fields = {"type": {"required": False, "type": "str"}}
    module = AnsibleModule(argument_spec=fields)

    if module.params['type'] == 'vm':
        fields = {
    "entity": {"required": False, "type": "str"},
            "region": {"required": False, "type": "str"},
            "product": {"default": False, "type": "str" },
            "environment": {"default": False, "type": "str" },
            "resource": {"required": False, "type": "str" },
            "os": {"default": False, "type": "str" },
            "type": {"required": True, "type": "str"},
        }
    else:
        fields = {
    "entity": {"required": True, "type": "str"},
            "region": {"required": True, "type": "str"},
            "product": {"default": True, "type": "str" },
            "environment": {"default": True, "type": "str" },
            "purpose": {"default": True, "type": "str" },
            "resource": {"required": True, "type": "str" },
            "acronym": {"default": True, "type": "str" },
            "type": {"required": True, "type": "str"},
        }

    module = AnsibleModule(argument_spec=fields)
     ......


but return error msg: 'Unsupported parameters for (generate_name) module:
entity, environment, os, product, region, resource Supported parameters
include: type'

How can valid type value?


-- 
Atenciosamente,

Rafael Tomelin
Tel.: 51-984104084
Skype: rafael.tomelin

LPI ID: LPI000191271
Red Hat Certified Engineer
Puppet Professional 2017 Certification

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGEUqbCZ38w-UGOPDopdxb4v4v1kaaoEK7AP8aDT6wWzMaoxPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to