I'm trying to use ansible to build a docker image locally but I'm running into problems.
- hosts: all
tasks:
- name: Build Docker image
local_action:
module: docker_image
path: .
name: SlothSloth
state: present
And my /etc/ansible/hosts contains
localhost ansible_connection=local
But when I try to run it I get:
TASK: [Build Docker image] ****************************************************
failed: [localhost -> 127.0.0.1] => {"failed": true, "parsed": false}
failed=True msg='failed to import python module: No module named docker.client'
FATAL: all hosts have already failed -- aborting
If you are using virtualenv, you are probably running ansible with /usr/bin/python by default. To bypass this behavior, you have to define the variable "ansible_python_interpreter".
Try to use :