-
-
Save marcingrzejszczak/a47ba311218d1b5373e4 to your computer and use it in GitHub Desktop.
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"] | |
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
docker run -d -p 2222:22 -e ROOT_PASS="root" marcin
docker build -t marcin .