I'm in the process of writing an Ansible module. 
I've currently got an Ansible task that includes this piece of code:

```
...
allowed:
  - ip_protocol: 'tcp'
  - port: '22'
...
```

AnsibleModule looks something like this:

```
  AnsibleModule(
    argument_spec=dict(
         allowed=dict(type='list', elements='dict', options=dict(
             IPProtocol=dict(required=True, type='str', 
aliases=['ip_protocol']),
             ports=dict(type='list', elements='str')
          ))
    )
  )
```

(tldr; ip_protocol is an alias of IPProtocol).

I end up doing some work with module.params later on. I would expect 
module.params to look like this:

```
{
  allowed: [
     {
        IPProtocol: 'tcp',
        ports: '22'
     }
   ]
}
```

Instead, it looks like this:

```
{
  allowed: [
     {
        IPProtocol: 'tcp',
        ip_protocol: 'tcp',
        ports: '22'
     }
   ]
}
```

Is there a way to get a version of module.params that doesn't have each 
alias listed out in this way?

-- 
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/a7962f3c-9127-4a0c-8711-1482b2e162a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to