docker - Issues getting Ansible to work with Boot2Docker -


i'm using ansible playbook manage installation of docker containers. have following playbook, installs cassandra:

i want run playbook locally, , have install boot2docker. able ssh boot2docker using instructions this answer:

$ ssh -i $home/.ssh/id_boot2docker -p 2022 docker@localhost                         ##        .                   ## ## ##       ==                ## ## ## ##      ===            /""""""""""""""""\___/ ===       ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~            \______ o          __/              \    \        __/               \____\______/  _                 _   ____     _            _ | |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __ | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ | |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_| boot2docker version 1.4.1, build master : 86f7ec8 - tue dec 16 23:11:29 utc 2014 docker version 1.4.1, build 5bc2ff8 docker@boot2docker:~$ 

i made inventory file same ssh settings:

[local] localhost ansible_ssh_port=2022 ansible_ssh_user=docker ansible_ssh_private_key_file=~/.ssh/id_boot2docker 

but when run playbook, fails error "/bin/sh: /usr/bin/python: not found":

$ ansible-playbook db-setup.yml -i hosts.local  play [local] ******************************************************************   gathering facts ***************************************************************  failed: [localhost] => {"failed": true, "parsed": false} /bin/sh: /usr/bin/python: not found openssh_6.2p2, osslshim 0.9.8r 8 dec 2011 debug1: reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: applying options * debug1: /etc/ssh_config line 102: applying options * debug1: auto-mux: trying existing master debug1: mux_client_request_session: master session id: 2 shared connection localhost closed.   task: [database] **************************************************************  fatal: no hosts matched or hosts have failed -- aborting   play recap ********************************************************************         retry, use: --limit @/users/bryan/db-setup.retry localhost                  : ok=0    changed=0    unreachable=0    failed=1    

i still error if "gather facts" turned off. if ssh boot2docker, can see /usr/bin/python exists:

$ ssh -i $home/.ssh/id_boot2docker -p 2022 docker@localhost ...  docker@boot2docker:~$ python 

boot2docker ssh "tce-load -w -i python.tcz" trick (you need internet ;-)) docker , ansible need "docker-py"

  1. setup pip, login boot2docker
  2. wget https://bootstrap.pypa.io/get-pip.py
  3. python get-pip.py
  4. pip install docker-py

also add inventory file:

dockerhost ansible_connection=ssh ansible_ssh_host=192.168.59.103 ansible_ssh_user=docker ansible_ssh_private_key_file=~/.ssh/id_boot2docker ansible_python_interpreter=/usr/local/bin/python 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -