
If you want to have a random password per host + client or whateverĪll you need to do to is use some templating and set the store path based on those parameters. Because you are using /dev/null as store path, you are forcing ansible to generate a new random password because everytime it checks for existence it finds nothing. So, first time it checks if the specified path exists, and if not generates a random password and stores it on that path, subsequent lookups will just retrieve it. Generates a random plaintext password and stores it in a file at a given filepath.īy definition,the lookup password generates a random password AND stores it on the specified path for subsequent lookups. name : Generate random string : var : lookup('_string') # Example result: - name : Generate random string with length 12 : var : lookup('_string', length=12) # Example result: - name : Generate base64 encoded random string : var : lookup('_string', base64=True) # Example result: - name : Generate a random string with 1 lower, 1 upper, 1 number and 1 special char (atleast) : var : lookup('_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) # Example result: - name : Generate a random string with all lower case characters debug : var : query('_string', upper=false, numbers=false, special=false) # Example result: - name : Generate random hexadecimal string debug : var : query('_string', upper=false, lower=false, override_special=hex_chars, numbers=false) vars : hex_chars : '0123456789ABCDEF' # Example result: - name : Generate random hexadecimal string with override_all debug : var : query(' problem is that you are using the password module wrong, or at least according to the latest documentation (maybe this a new feature on 2.5):



