Repository: ansible/ansible-modules-extras

Issue:
consul_acl documentation for token type option appears to be incorrect
##### ISSUE TYPE

<!--- Pick one below and delete the rest: -->
- Documentation Report
##### COMPONENT NAME

<!--- Name of the plugin/module/task -->

consul_acl
##### ANSIBLE VERSION

```
ansible 2.0.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
```
##### CONFIGURATION

<!---
Mention any settings you have changed/added/removed in ansible.cfg
(or using the ANSIBLE_* environment variables).
-->

N/A
##### OS / ENVIRONMENT

<!---
Mention the OS you are running Ansible from, and the OS you are
managing, or say “N/A” for anything that is not platform-specific.
-->

N/A
##### SUMMARY

<!--- Explain the problem briefly -->

The documentation for the consul_acl module lists the option `type` for controlling token type, but using this option results in an error. Internally it appears the actual option name is `token_type`. Documentation should reflect this.
##### STEPS TO REPRODUCE

<!---
For bugs, show exactly how to reproduce the problem.
For new features, show how the feature would be used.
-->

A task with the following will fail:

```
- name: create deploy token
  consul_acl:
    mgmt_token: 'super-top-secret'
    name: 'special token'
    token: 'top-secret'
    type: management
    state: present
```

A task with the following will succeed:

```
- name: create deploy token
  consul_acl:
    mgmt_token: 'super-top-secret'
    name: 'special token'
    token: 'top-secret'
    token_type: management
    state: present
```

<!--- You can also paste gist.github.com links for larger files -->
##### EXPECTED RESULTS

The documented option should work as described.
##### ACTUAL RESULTS

Using the documented option results in the following output:

```
TASK [acls : create alerts token] **********************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: type"}
```

Fixing incorrect option name for consul_acl
##### ISSUE TYPE

<!--- Pick one below and delete the rest: -->
- Docs Pull Request
##### COMPONENT NAME

<!--- Name of the plugin/module/task  -->

consul_acl
##### ANSIBLE VERSION

```
ansible 2.0.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
```
##### SUMMARY

<!--- Describe the change, including rationale and design decisions -->

The code is looking for `token_type`. Updated the documentation to specify `token_type` instead of `type`.

<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
commit message and your description; but you should still explain what
the change does.
-->

Fixes #2213



Discussion:

Thanks @NitroPye for this PR. This PR requires revisions, either because it fails to build or by reviewer request. Please make the suggested revisions. When you are done, please comment with text 'ready_for_review' and we will put this PR back into review.

[This message brought to you by your friendly Ansibull-bot.]

@NitroPye A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes. When you do address the issues, please respond with ready_for_review in your comment, so that we can notify the maintainer.

[This message brought to you by your friendly Ansibull-bot.]

@NitroPye Another friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open. If you have addressed the issues and believe it's ready for review, please comment with the text "ready_for_review". If we don't hear from you within another 14 days, we will close this pull request.

[This message brought to you by your friendly Ansibull-bot.]

@NitroPye A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes. When you do address the issues, please respond with ready_for_review in your comment, so that we can notify the maintainer.

[This message brought to you by your friendly Ansibull-bot.]


Resolving patch:
diff --git a/clustering/consul_acl.py b/clustering/consul_acl.py
--- a/clustering/consul_acl.py
+++ b/clustering/consul_acl.py
@@ -37,14 +37,16 @@
           - a management token is required to manipulate the acl lists
     state:
         description:
-          - whether the ACL pair should be present or absent, defaults to present
+          - whether the ACL pair should be present or absent
         required: false
         choices: ['present', 'absent']
-    type:
+        default: present
+    token_type:
         description:
           - the type of token that should be created, either management or
-            client, defaults to client
+            client
         choices: ['client', 'management']
+        default: client
     name:
         description:
           - the name that should be associated with the acl key, this is opaque


Test patch: