Skip to content

Instantly share code, notes, and snippets.

@marcingrzejszczak
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcingrzejszczak/a47ba311218d1b5373e4 to your computer and use it in GitHub Desktop.
Save marcingrzejszczak/a47ba311218d1b5373e4 to your computer and use it in GitHub Desktop.
Dockerfile - debian with python
FROM tutum/debian:wheezy
# Install packages
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y install python python-apt man less vim cowsay curl wget
RUN export LANGUAGE=en_US.UTF-8
RUN export LANG=en_US.UTF-8
RUN export LC_ALL=en_US.UTF-8
#RUN dpkg-reconfigure locales
#RUN locale-gen en_US.UTF-8
EXPOSE 22
EXPOSE 80
EXPOSE 9200
CMD ["/run.sh"]
@marcingrzejszczak
Copy link
Author

docker build -t marcin .

@marcingrzejszczak
Copy link
Author

@marcingrzejszczak
Copy link
Author

fatal: [localhost] => Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host.


SOLUTION:

In order to use the ansible_ssh_pass parameter you first need to install the sshpass program. This allows you to send passwords to SSH commands, and Ansible utilises this program to send passwords to it's own connections. If you are on Ubuntu you can install sshpass like this.

sudo apt-get install sshpass
If you try to connect with Ansible now you might get an authentication failed message, even if the password is correct. This is because your local system is trying to ask if you want to store a key check of the host you are connecting to, which gets in the way of Ansible trying to connect. To disable the host key check you need to create a file called ansible.cfg (in the same folder as your inventory file) and add the following.

1
2
[defaults]
host_key_checking=false

http://www.hashbangcode.com/blog/ansible-ssh-setup-playbook

@marcingrzejszczak
Copy link
Author

docker run -d -p 2222:22 -e ROOT_PASS="root" marcin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment