From e2b75abb1dda5fd1ff3f7b6b2b5441992146c24d Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 11 Nov 2013 14:54:11 -0500 Subject: [PATCH] Add char parameter to password lookup plugin docs on docsite --- docsite/rst/playbooks_lookups.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docsite/rst/playbooks_lookups.rst b/docsite/rst/playbooks_lookups.rst index 817e4481013..7178cb06c10 100644 --- a/docsite/rst/playbooks_lookups.rst +++ b/docsite/rst/playbooks_lookups.rst @@ -53,6 +53,32 @@ This length can be changed by passing an extra parameter:: .. note:: If the file already exists, no data will be written to it. If the file has contents, those contents will be read in as the password. Empty files cause the password to return as an empty string +Starting in version 1.4, password accepts a "chars" parameter to allow defining a custom character set in the generated passwords. It accepts comma separated list of names that are either string module attributes (ascii_letters,digits, etc) or are used literally:: + + --- + - hosts: all + + tasks: + + # create a mysql user with a random password using only ascii letters: + - mysql_user: name={{ client }} + password="{{ lookup('password', '/tmp/passwordfile chars=ascii') }}" + priv={{ client }}_{{ tier }}_{{ role }}.*:ALL + + # 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 + + # create a mysql user with a random password using many different char sets: + - mysql_user: name={{ client }} + password="{{ lookup('password', '/tmp/passwordfile chars=ascii,numbers,digits,hexdigits,punctuation') }}" + priv={{ client }}_{{ tier }}_{{ role }}.*:ALL + + (...) + +To enter comma use two commas ',,' somewhere - preferably at the end Qoutes and double qoutes are not supported + .. _more_lookups: More Lookups