I am trying to run a play book from host(ansible VM) to pull an image from docker host, I tried pip install docker still it not working, can you please help.
failed to import the required python library (docker sdk for python: docker (python >= 2.7) or docker-py (python 2.6)) on host's python /usr/bin/python3. please read module documentation and install in the appropriate location, for example via pip install docker or pip install docker-py (python 2.6). the error was: no module named request.exceptions")
On 10/16/19 8:07 PM, Sunitha Iyer wrote:
> I am trying to run a play book from host(ansible VM) to pull an image from docker host, I tried pip install docker still
> it not working, can you please help.
>
>
> failed to import the required python library (docker sdk for python: docker (python >= 2.7) or docker-py (python 2.6))
> on host's python /usr/bin/python3. please read module documentation and install in the appropriate location, for example
> via pip install docker or pip install docker-py (python 2.6). the error was: no module named request.exceptions")
Try to set the following variable to make sure Ansible uses Python3 on the target host:
ansible_python_interpreter: /usr/bin/python3
Regards
Racke
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> > ansible...@googlegroups.com <javascript:> <mailto:ansible-project+unsub...@googlegroups.com <javascript:>>.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com>
> >
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> > > ansible...@googlegroups.com <javascript:> <mailto:ansible-project+unsub...@googlegroups.com <javascript:>
> <javascript:>>.
> > > To view this discussion on the web visit
> > > https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com>
> > <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com>>
> > >
> >
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com?utm_medium=email&utm_source=footer>
>
> >
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/60121656-a085-444f-8081-f14f069bace5%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
>
> >
> >
> >
> > --
> > Ecommerce and Linux consulting + Perl and web application programming.
> > Debian and Sympa administration. Provisioning with Ansible.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> > ansible...@googlegroups.com <javascript:> <mailto:ansible-project+unsub...@googlegroups.com <javascript:>>.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/ansible-project/66728461-928d-4691-bfa9-4204c7ffb4a8%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/66728461-928d-4691-bfa9-4204c7ffb4a8%40googlegroups.com>
> >
> <https://groups.google.com/d/msgid/ansible-project/66728461-928d-4691-bfa9-4204c7ffb4a8%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/66728461-928d-4691-bfa9-4204c7ffb4a8%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
bash-4.4# ansible-playbook 04-loadbalancer.yml
PLAY [master] **********************************************************************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************************************************ok: [master01]
TASK [loadbalancer : make lb dir] **************************************************************************************************************************************************************************ok: [master01]
TASK [loadbalancer : generate lb config] *******************************************************************************************************************************************************************ok: [master01]
TASK [loadbalancer : copy lb images] ***********************************************************************************************************************************************************************changed: [master01]
TASK [loadbalancer : load lb image] ************************************************************************************************************************************************************************fatal: [master01]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on localhost.localdomain's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named requests.exceptions"}
PLAY RECAP *************************************************************************************************************************************************************************************************master01 : ok=4 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
bash-4.4# ansible --versionansible 2.9.2 config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible python version = 3.6.9 (default, Oct 17 2019, 11:10:22) [GCC 8.3.0]
- name: load lb image shell: 'docker load -i {{ dpath }}/loadbalancer/haproxy-{{ haproxy_version }}.tar.bz2'# docker_image:# load_path: '{{ dpath }}/loadbalancer/haproxy-{{ haproxy_version }}.tar.bz2'# name: lb# timeout: 600