geerlingguy/ansible-role-awx

docker-compose

hhouissa opened this issue · 9 comments

the playbook fails with below error:
Unable to load docker-compose. Try pip install docker-compose. Error: Traceback (most recent call last):\n File \"/tmp/ansible_docker_service_payload_MtsKkc/ansible_docker_service_payload.zip/ansible/modules/cloud/docker/_docker_service.py

server is new redhat7 and has only what comes from redhat.
all playbooks ran fine except the awx role.
would you please advise?
Thanks,
--Haythem.

Information from destination server:
[ansible@rhel7-prod ~]$ docker-compose --version
docker-compose version 1.24.1, build 4667896b
[ansible@rhel7-prod ~]$ sudo su
[root@rhel7-prod ansible]# docker-compose --version
bash: docker-compose: command not found
[root@rhel7-prod ansible]# npm --version
3.10.10
[root@rhel7-prod ansible]# docker --version
Docker version 19.03.5, build 633a0ea
[root@rhel7-prod ansible]# docker-compose --version
bash: docker-compose: command not found
[root@rhel7-prod ansible]# pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

How come docker-compose gets installed for the ansible user (same user as in ansible server) but not for the root?

I think I have same issue on my Centos 7(1901) server.

Problem is that python module docker-compose is not installed. I tried to fix that manualy and failed on missing dev python libraries. I fixed that by installing them by yum install python-devel

Then i came into another issue, that python module docker-py is installed, which is in confilct with docker-compose. It is referenced in install manual https://github.com/ansible/awx/blob/devel/INSTALL.md#prerequisites-3

I believe there is an issue in the dependency tree somewhere when bringing down docker-compose.

having the following tasks post the suggested awx - per-requisite install seems to fix issues (note how it is forcing the correct version of more-itertools for python 2.7.*)

` tasks:

  • name: uninstall docker-py
    pip:
    name: docker-py
    state: absent
  • name: 'Docker reqs'
    yum:
    name: python-devel
    state: present
  • name: gcc
    yum:
    name: gcc
    state: present
  • name: 'Install docker-compose library'
    pip:
    name: docker-compose
  • name: Force correct version of more-itertools
    pip:
    name: more-itertools
    version: 5.0.0
    state: forcereinstall
stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

Hi Guys,

I believe I have run into the same issue and have found a work around. Although I have not tested AWX functionality any further than the initial install and login..

I ran a pre_task to install python3
Update geerlinguy-pip vars:

  pip_package: python3-pip
  pip_executable: pip3
  pip_install_pacakges:
    - name: docker
    - name: docker-compose
    - name: selinux

I added "-e ansible_python_interpreter=/usr/bin/python3" to the "Run the AWX Installation playbook" task in aws-install-playbook.yml (geerlingguy.awx):

ansible-playbook -i inventory install.yml -e postgres_data_dir={{ postgres_data_dir }} -e ansible_python_interpreter=/usr/bin/python3

I have to restart Docker after it completes (not sure why) but after doing so it finishes the migration and I am able to login to the GUI.

stale commented

This issue is no longer marked for closure.

@thursdaddy suggestion worked for me. The awx installer assumes python3, so if that's not your default...

stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.