29Jul
Ansible: User module and Password hashing
Ansible user module is used to create and manage the user access majorly in Unix servers. Below is an example of the ansible task in playbook shows usage of the ansible user module.
tasks:
- name: create new user
user:
name: deployer
password: anspassword
shell: /bin/bash
But when we try to use this module in playbooks, writing plain password text inside file is unshackled, results in various security concerns. These passwords must be hashed to use with user module.
Password hashing: It is method in which a variable length of plain password is taken as input and with cryptic mechanism creating fixed length of cryptic password.
Hashing is one-way road, revering the password into normal string is highly difficult, makes more secure. If we want to level up in security, we can use salt values which generate more secured hash passwords.
Methods of Password hashing: There are serval different ways we can hash the password but the below are the most common techniques used is MDA and SHA.
1)Password hashing using Python: Below command with random salt will prompt user to type password and with using sha-512 algorithm gives cryptic password.
pyhton -c ‘import crypt,getpass; print crypt.crypt(getpass.getpass( ))’

So, we can make use of hashed password in the playbook to use the user module in efficient way.
2)Openssl (With random salt value): Open ssl makes use of MD5 algorithm with random salt value generates the hashed password.
Command:
Openssl passwd -1 -salt $(openssl rand -base64 6) mypassword

Same as above, generated cryptic password can be used for user module in ansible for parallel execution of user id creation in n number of Unix servers.
Most of the Unix servers will follow the SHA 512 algorithm so it is advisable to follow the cryptic password which is generated with the Sha-512 algorithm. If you want to check what kind of algorithm the servers have, we can make use of below command.

Related
Ansible is an open source, IT automation tool. It can configure systems, deploy software, and orches...
Read More >
Please watch LIVE RECORDING Video of the webinar session below which took place on 28th Ja...
Read More >
Hi All, in this blog I would like to share few insights on how you can leverage GitHub for your deve...
Read More >
In general chart means visual display of information, this is one such feature that is introduced in...
Read More >
Playbooks are nothing but files consisting of your written code, and they are written in YAML langua...
Read More >
Microsoft has released the preview version of Visual Studio 2015 and .NET 4.6 for developers to try ...
Read More >
Bangalore, Karnataka, India — May 29, 2014 — Canarys, today announced it has been named ...
Read More >
jTemplate is a template engine plug-in for jQuery and is commonly used to display tabular data ...
Read More >
Explains how to build online help pages in bulk for 2013 R2 version of NAV using merge tool. It incl...
Read More >
Share