N
N
Nikolay Baranenko2021-12-07 14:27:26
Python
Nikolay Baranenko, 2021-12-07 14:27:26

How to correctly connect the environment on the host for python for ansible:2.9.24?

I want to roll out the assembled docker image in a test environment and then update the container.

I use gitlab ci and ansible
on the target host is anaconda and there are several environments

#  /opt/anaconda2/bin/conda env list
# conda environments:
#
py36                     /opt/Anaconda3-4.4.0/envs/py36
py38                     /opt/Anaconda3-4.4.0/envs/py38
root                  *  /opt/Anaconda3-4.4.0


in gitlab ci I use ansible:2.9.24-9

image: $CI_REGISTRY/platform/docker-images/ansible:2.9.24-9


and

/opt/Anaconda3-4.4.0/envs/py36

playbook

---
- name: Deploy Web on Host
  hosts: '{{ target_host }}'
  vars_prompt:
    - name: 'target_host'
      prompt: 'Enter a target host name or a group name where uploads should be installed'
      private: false  
  vars:
    ansible_python_interpreter: /opt/Anaconda3-4.4.0/envs/py36/bin/python
  become: true
  become_user: root

  tasks:
    - debug: msg='Ansible works on host {{ ansible_fqdn }}'

    - name: Install pip packages
      pip:
        name: 
          - docker
          - docker-py
        state: forcereinstall
        virtualenv: /opt/Anaconda3-4.4.0/envs/py36

    - name: Pull default Docker image
      docker_image:
        name: "tools/web:ui_v1.0.1-dev.188"
        source: pull


Pull default Docker image task
returns an error

TASK [Pull default Docker image] ***********************************************
fatal: [project-dev]: FAILED! => {"changed": false, "msg": "Cannot have both the docker-py and docker python modules (old and new version of Docker SDK for Python) installed together as they use the same namespace and cause a corrupt installation. Please uninstall both packages, and re-install only the docker-py or docker python module (for test-host-0025's Python /opt/Anaconda3-4.4.0/envs/py36/bin/python). It is recommended to install the docker module if no support for Python 2.6 is required. Please note that simply uninstalling one of the modules can leave the other module in a broken state."}


I check /opt/Anaconda3-4.4.0/envs/py36
docker and docker-py did not appear there. So,

is it correct to connect the environment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2021-12-07
@drno-reg

It is written in black and white that the docker-py and docker packages are in conflict, both of them must be removed and then only one of them should be installed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question