Skip to main content

Posts

Showing posts from July, 2015

Randomly Generating User Passwords Using Ansible

First, i would like to note that i have recently started using Ansible for configuration management. One of the things i need in my server environment is to implement a user password changing policy. Since the targets are numerous, i have to use randomly generated passwords for each host. Because passwords are sensitive, they should be generated in the encrypted form. Ansible documentation recommends using python passlib library and SHA512 hashing here.

Ansible requires python-simplejson when Python version is 2.4

Ansible requires python-simplejson package when python version is 2.4.

192.168.1.21 | FAILED >> {
    "failed": true,
    "msg": "Error: ansible requires a json module, none found!OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: mux_client_request_session: master session id: 2\r\nShared connection to 192.168.1.21 closed.\r\n",
    "parsed": false
}


On Redhat 5, following package should be installed:

# rpm -ivh python-simplejson-2.0.9-8.el5.x86_64.rpm


Then from ansible:

# ansible server11 -m ping
192.168.1.21 | success >> {
    "changed": false,
    "ping": "pong"
}