Awx: AWX Docker-Compose installation failed with Configuration error

Created on 17 Sep 2019  ยท  13Comments  ยท  Source: ansible/awx

ISSUE TYPE
  • Bug Report
SUMMARY

command
ansible-playbook -i inventory install.yml
failed with error:

TASK [local_docker : Stop AWX before upgrading postgres] *****************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Configuration error - \n        Can't find a suitable configuration file in this directory or any\n        parent. Are you in the right directory?\n\n        Supported filenames: docker-compose.yml, docker-compose.yaml\n        "}

inventory is localhost

ENVIRONMENT
  • AWX version: 7.0.0
  • AWX install method: docker on linux
  • Ansible version: 2.8.5
  • docker-compose version: 1.24.1
  • Operating System: Debian GNU/Linux 9.4 (stretch)
STEPS TO REPRODUCE

git clone https://github.com/ansible/awx.git
cd awx/installer/
ansible-playbook -i inventory install.yml

EXPECTED RESULTS

AWX docker images to build successfully

ACTUAL RESULTS
PLAY [Build and deploy AWX] ***************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************
ok: [localhost]

TASK [check_vars : include_tasks] ***************************************************************************************************************
skipping: [localhost]

TASK [check_vars : include_tasks] ***************************************************************************************************************
included: /root/awx/awx/installer/roles/check_vars/tasks/check_docker.yml for localhost

TASK [check_vars : postgres_data_dir should be defined] ******************************************************************************************************
ok: [localhost] => {
    "changed": false, 
    "msg": "All assertions passed"
}

TASK [check_vars : host_port should be defined] **************************************************************************************************************
ok: [localhost] => {
    "changed": false, 
    "msg": "All assertions passed"
}

TASK [image_build]   # ALL ***************************************************************************************************************
ok: [localhost]
# with https://github.com/ansible/awx/issues/4759#issuecomment-532005413

TASK [image_push]   # ALL ***************************************************************************************************************
skipping: [localhost]


TASK [kubernetes]   # ALL ***************************************************************************************************************
skipping: [localhost]


TASK [local_docker : Check for existing Postgres data] *******************************************************************************************************
ok: [localhost]

TASK [local_docker : Record Postgres version] ****************************************************************************************************************
ok: [localhost]

TASK [local_docker : Determine whether to upgrade postgres] **************************************************************************************************
ok: [localhost]

TASK [local_docker : Set up new postgres paths pre-upgrade] **************************************************************************************************
ok: [localhost] => (item=/tmp/pgdocker/10/data)

TASK [local_docker : Stop AWX before upgrading postgres] *****************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Configuration error - \n        Can't find a suitable configuration file in this directory or any\n        parent. Are you in the right directory?\n\n        Supported filenames: docker-compose.yml, docker-compose.yaml\n        "}
        to retry, use: --limit @/root/.ansible-retry/install.retry

PLAY RECAP ***************************************************************************************************************
localhost                  : ok=8    changed=0    unreachable=0    failed=1   
ADDITIONAL INFORMATION
installer medium needs_devel bug

Most helpful comment

docker_compose_dir="~/.awx/awxcompose"

Replace the above line in awx/installer/inventory file with absolute path of awxcompose directory

Like this

docker_compose_dir="/home/YOUR_USERNAME/.awx/awxcompose"

Somehow, '~' was not working in this case.

Hope this helps.

All 13 comments

The work around for me was to set the when clause to false, since this service wasn't started yet.
https://github.com/ansible/awx/blob/70057bc0f26318cd516f5c05aa1d36f0570c577d/installer/roles/local_docker/tasks/main.yml#L29

The issues is because compose.yml has not run yet, so there is no compose directory. https://github.com/ansible/awx/blob/70057bc0f26318cd516f5c05aa1d36f0570c577d/installer/roles/local_docker/tasks/main.yml#L52

Seeing this same behavior/error myself.
Fresh install of Ubuntu 19.

Additionally, i had to specifically specify the python interpreter in the run playbook command in order to remove Python errors during the playbook run.
sudo ansible-playbook -i inventory install.yml -e ansible_python_interpreter=/usr/bin/python3

The work around for me was to set the when clause to false, since this service wasn't started yet.
https://github.com/ansible/awx/blob/70057bc0f26318cd516f5c05aa1d36f0570c577d/installer/roles/local_docker/tasks/main.yml#L29

The issues is because compose.yml has not run yet, so there is no compose directory.

https://github.com/ansible/awx/blob/70057bc0f26318cd516f5c05aa1d36f0570c577d/installer/roles/local_docker/tasks/main.yml#L52

@dhoer can you clarify what variable you changed in more detail please?
I would like to test your workaround on the problem system i have here too.
Thanks!

I set line 29 to be when: false.

I set line 29 to be when: false.

Thanks for replying
What's the full line as that does not work for me sorry.

Just saw this. Sounds like you might have a different issue.

I set line 29 to be when: false.

Thanks for replying
What's the full line as that does not work for me sorry.

Sorry, @dhoer said - set line to when: false
That means:
You go to line 29
Delete all in a line after when:
Type <spacebar_key>false
Save file
Restart your AWX setup\upgrade.

Always remember YAML file format and pay attention on space indentations!!

That worked for me from scratch.
Thanks again @dhoer !!!

Hi I now might face a very similar issue when running "sudo ansible-playbook -i inventory install.yml":
TASK [local_docker : Create Docker Compose Configuration] *********************************
task path: /home/pschellhaas/awx/installer/roles/local_docker/tasks/compose.yml:19
failed: [localhost] (item=environment.sh) => {"ansible_loop_var": "item", "changed": false, "checksum": "18957af76126a0769a3d66e4e5a62ff17144eed2", "item": "environment.sh", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=credentials.py) => {"ansible_loop_var": "item", "changed": false, "checksum": "48cbcdaf1cead80ad0814154bd694c7356c06fc4", "item": "credentials.py", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=docker-compose.yml) => {"ansible_loop_var": "item", "changed": false, "checksum": "7c65cd4ab9bba817e4cca1b71bf7f162fa82d94a", "item": "docker-compose.yml", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=nginx.conf) => {"ansible_loop_var": "item", "changed": false, "checksum": "5706491c1c00d32dd0a1b96a88c12a842ccbf32c", "item": "nginx.conf", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=redis.conf) => {"ansible_loop_var": "item", "changed": false, "checksum": "1aa72e3d67e906b78904e22af5ced22b2d98bfb7", "item": "redis.conf", "msg": "Destination directory /root/.awx/awxcompose does not exist"}

PLAY RECAP ************************************************
localhost : ok=12 changed=0 unreachable=0 failed=1 skipped=97 rescued=0 ignored=0

It seems to affect the following variable in inventory file:

ssl_certificate=

docker_compose_dir="~/.awx/awxcompose"

I did not make any changes and have run awx installation with standard parameters. Any idea what I can do to fix this issue? Thanks in advance!

Hi I now might face a very similar issue when running "sudo ansible-playbook -i inventory install.yml":
TASK [local_docker : Create Docker Compose Configuration] *********************************
task path: /home/pschellhaas/awx/installer/roles/local_docker/tasks/compose.yml:19
failed: [localhost] (item=environment.sh) => {"ansible_loop_var": "item", "changed": false, "checksum": "18957af76126a0769a3d66e4e5a62ff17144eed2", "item": "environment.sh", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=credentials.py) => {"ansible_loop_var": "item", "changed": false, "checksum": "48cbcdaf1cead80ad0814154bd694c7356c06fc4", "item": "credentials.py", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=docker-compose.yml) => {"ansible_loop_var": "item", "changed": false, "checksum": "7c65cd4ab9bba817e4cca1b71bf7f162fa82d94a", "item": "docker-compose.yml", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=nginx.conf) => {"ansible_loop_var": "item", "changed": false, "checksum": "5706491c1c00d32dd0a1b96a88c12a842ccbf32c", "item": "nginx.conf", "msg": "Destination directory /root/.awx/awxcompose does not exist"}
failed: [localhost] (item=redis.conf) => {"ansible_loop_var": "item", "changed": false, "checksum": "1aa72e3d67e906b78904e22af5ced22b2d98bfb7", "item": "redis.conf", "msg": "Destination directory /root/.awx/awxcompose does not exist"}

PLAY RECAP ************************************************
localhost : ok=12 changed=0 unreachable=0 failed=1 skipped=97 rescued=0 ignored=0

It seems to affect the following variable in inventory file:

ssl_certificate=

docker_compose_dir="~/.awx/awxcompose"

I did not make any changes and have run awx installation with standard parameters. Any idea what I can do to fix this issue? Thanks in advance!

I also came accross the same problem as yourself, to resolve i had to manually create the directory /root/.awx/awxcompose, i then ran the playbook again and it created each of the files in the directory i created (docker-compose.yml, redis.conf ect) but then the following task failed:
TASK [local_docker : Set redis config to other group readable to satisfy redis-server] **********************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "file (/home/bobby/.awx/awxcompose/redis.conf) is absent, cannot continue", "path": "/home/bobby/.awx/awxcompose/redis.conf"}

It was trying to look back in the original location again so i updated the following line in the inventory which resolved the issue:
docker_compose_dir="/root/.awx/awxcompose"

Hopefully that helps someone else that had the same issue as myself!

Responding here in case it helps anyone else as I was having problems, it seems caused because I had logged in as an unprivileged user then used 'su' rather than 'su -' before beginning installation. As a result the first few config files were created under /home/jonny/.awx/awxcompose but the later stages of the installation used /root/.awx/awxcompose The result was that important files under /etc/tower including SECRET_KEY environment.sh did not exist under /root/.awx/awxcompose when the containers were started so the references to those files in the docker-compose were created as directories inside the container (default for docker if files don't exist) rather than files with the file contents.
Not sure if there is a useful fix for this as the installer uses ~. Maybe specifying the install path in the inventory is the solution.
Some of the errors I got along the way included the following in case it helps anyone searching for similar:

failed: [localhost] (item=environment.sh) => {"ansible_loop_var": "item", "changed": false, "checksum": "146", "item": "environment.sh", "msg": "Destination directory /home/jonny/.awx/awxcompose does not exist"}
IsADirectoryError: [Errno 21] Is a directory: '/etc/tower/SECRET_KEY'
django.core.exceptions.ImproperlyConfigured: No AWX configuration found at /etc/tower/settings.py

did you try with "sudo ansible-playbook -i inventory install.yml"??
I solved the problem by sudo permission.

docker_compose_dir="~/.awx/awxcompose"

Replace the above line in awx/installer/inventory file with absolute path of awxcompose directory

Like this

docker_compose_dir="/home/YOUR_USERNAME/.awx/awxcompose"

Somehow, '~' was not working in this case.

Hope this helps.

docker_compose_dir="~/.awx/awxcompose"

Replace the above line in awx/installer/inventory file with absolute path of awxcompose directory

Like this

docker_compose_dir="/home/YOUR_USERNAME/.awx/awxcompose"

Somehow, '~' was not working in this case.

Hope this helps.

worked, thanks

Was this page helpful?
0 / 5 - 0 ratings