Hi There,
I’m attempting to configure ssh access to a user via ansible, as described in the blog entry at:
http://www.hashbangcode.com/blog/ansible-ssh-setup-playbook
I’m running this playbook using ansible version 1.4.5 on rhel 6.3.
My inventory hosts file looks like:
[hosts]
172.20.0.36 ansible_connection=ssh ansible_ssh_user=deployment ansible_ssh_pass=password
I have sshpass installed:
[ansible@rwc-host1 inventory]$ sudo yum list | grep sshpass
sshpass.x86_64 1.05-1.el6 @epel
My ansible.cfg file looks like this:
[ansible@rwc-host1 inventory]$ cat ansible.cfg
[defaults]
host_key_checking=False
[ansible@rwc-host1 inventory]$
I already have the user created on the remote server with sudo access, so all the playbook really needs to do is take the contents of id_rsa.pub and add it to the authorized_keys file for the remote user.
The user I’m connecting as is the same as the user who’s authorized_keys file I want to create.
However, the user I’m running the playbook as on the ansible control machine is different.
For example, the control user is named ‘ansible’ and the remote user is named ‘deployment’
The playbook file is: