From the course: Ansible: From Basics to Guru by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Creating random passwords

Creating random passwords

Another nice example of using plugins is the plugin that creates random passwords, the password lookup plugin. So the password lookup plugin can be used to generate random passwords and store these passwords in a local file. And you should know that strictly the password plugin generates a random string, and using it as a password makes it the password. But that doesn't matter, as long as you use it the right way. So how do you use it? Well, you use it to define a variable, my password. And my password is using lookup password credentials plus item length is 6. And that defines directly with the name credentials with a file that matches the username so that the password can be handed out to the user later. And after defining the variable, you can use it as a password by applying to the password hash filter. We already have seen an example before, but let's check out users with password so that we understand what exactly is going on. So here is users with password. And what do we see?…

Contents