Parameter |
Choices/Defaults |
Configuration |
Comments |
---|---|---|---|
_terms
required |
|
|
path to the file that stores/will store the passwords
|
chars
(added in 1.4) |
|
|
Define comma separated list of names that compose a custom character set in the generated passwords.
By default generated passwords contain a random mix of upper and lowercase ASCII letters, the numbers 0-9 and punctuation (". , : - _").
They can be either parts of Python's string module attributes (ascii_letters,digits, etc) or are used literally ( :, -).
To enter comma use two commas ',,' somewhere - preferably at the end. Quotes and double quotes are not supported.
|
encrypt
|
Default:
yes
|
|
Whether the user requests that this password is returned encrypted or in plain text.
Note that the password is always stored as plain text.
Encrypt also forces saving the salt value for idempotence.
|
length
|
Default:
20
|
|
The length of the generated password.
|
Note
- name: create a mysql user with a random password
mysql_user:
name: "{{ client }}"
password: "{{ lookup('password', 'credentials/' + client + '/' + tier + '/' + role + '/mysqlpassword length=15') }}"
priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"
- name: create a mysql user with a random password using only ascii letters
mysql_user: name={{ client }} password="{{ lookup('password', '/tmp/passwordfile chars=ascii_letters') }}" priv='{{ client }}_{{ tier }}_{{ role }}.*:ALL'
- name: create a mysql user with a random password using only digits
mysql_user:
name: "{{ client }}"
password: "{{ lookup('password', '/tmp/passwordfile chars=digits') }}"
priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"
- name: create a mysql user with a random password using many different char sets
mysql_user:
name: "{{ client }}"
password: "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits,hexdigits,punctuation') }}"
priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"
Common return values are documented here, the following are the fields unique to this lookup:
Key |
Returned |
Description |
---|---|---|
_raw
|
a password
|
Hint
If you notice any issues in this documentation you can edit this document to improve it.