ipahost: Return generated random password

The random password is only returned if random is yes and the host did
not exist or update_password is yes.

If only one host is handled by the module, the returned dict is containing
this dict:

  { "randompassword": "<the host random password>" }

If several hosts are handled by the module (future feature):

  { "<host>": { "randompassword": "<the host random password>" } }

Fixes issue #134 (ipahost does not return the random password)
This commit is contained in:
Thomas Woerner
2019-11-20 11:20:44 +01:00
parent b5f209225b
commit c36cb9543b
4 changed files with 113 additions and 5 deletions

View File

@@ -101,6 +101,11 @@ Example playbook to initiate the generation of a random password to be used in b
description: Example host
ip_address: 192.168.0.123
random: yes
register: ipahost
- name: Print generated random password
debug:
var: ipahost.host.randompassword
```
@@ -167,6 +172,21 @@ Variable | Description | Required
`state` | The state to ensure. It can be one of `present`, `absent` or `disabled`, default: `present`. | yes
Return Values
=============
ipahost
-------
There are only return values if one or more random passwords have been generated.
Variable | Description | Returned When
-------- | ----------- | -------------
`host` | Host dict with random password. (dict) <br>Options: | If random is yes and host did not exist or update_password is yes
&nbsp; | `randompassword` - The generated random password | If only one host is handled by the module
&nbsp; | `name` - The host name of the host that got a new random password. (dict) <br> Options: <br> &nbsp; `randompassword` - The generated random password | If several hosts are handled by the module
Authors
=======