Awx: No /var/lib/awx/projects folder

Created on 17 Dec 2017  路  16Comments  路  Source: ansible/awx

ISSUE TYPE

  • Bug Report
COMPONENT NAME

  • UI
  • Installer
SUMMARY


The /var/lib/awx/projects folder does not created.
Because of this, no projects can be created.
But the demo project (SCM update) appears to run with no errors.
After this, I see a _4__demo_project folder in the pull down, but when I try to save
the project, I get a "Failed to update project: 4. PUT status: 400" Error.
And the project is never created.

ENVIRONMENT
  • AWX version: AWX 1.0.2.293
  • AWX install method: docker on linux, (Federa server 26, Fedora 27, CentOS 1708)
  • Ansible version: 2.4.2.0.1
  • Operating System: (Federa server 26, Fedora 27, CentOS 1708)
  • Web Browser: Internet Explorer, Chrome, Firefox
STEPS TO REPRODUCE


Install, run the "Demo Project" (SCM)
Then create a new project. I used SCM type "manual", project name "Test1"

EXPECTED RESULTS

The project would be created.

ACTUAL RESULTS

Error: "Failed to update project: 4. PUT status: 400"

ADDITIONAL INFORMATION

Installed using this link.
http://khmel.org/?p=1245
No errors during the git, or the ansible-playbook installation.
I am able to docker exec -it (instance) /bin/bash into the containers.
I am not sure if this folder belong in the web container or the tasks container, so I
created it in both containers. I then attempted the chown the folder to "awx"
but it says the user doesn't exist. I can do a useradd, and chown the folder afterwards,
but the new project still fails with the same error. I get the same error on three different
versions of Linux. I have tried this on a standalone server (8 cores, 72 GB)
and a VM, (2 core, 8 GB). (Both have well over 20GB disk space)
Running playbooks outside the AWX environment seem to work fine. (CLI)

installer ui bug

Most helpful comment

Note to users landing on this page: the issue was closed, now you just have to uncomment this line in ./installer/inventory:

;project_data_dir=/var/lib/awx/projects

Then re-run ansible-playbook -i inventory install.yml and you're done.

All 16 comments

A shared docker volume need to be setup for both the awx_web and awx_task containers, then you can manage your playbooks/projects from single location on the docker host.

You can do this before executing the installer.

Edit/update the inventory file and set a path.

# AWX Project Data Folder
project_data_dir=/opt/awx_projects

Then edit awx/installer/local_docker/tasks/main.yml and set the volume for both the awx_web and awx_task containers.

volumes:
  - "{{ project_data_dir }}:/var/lib/awx/projects:rw"
  • name: Activate AWX Web Container
    docker_container:
    name: awx_web
    state: started
    restart_policy: unless-stopped
    image: "{{ awx_web_docker_actual_image }}"
    **volumes:

  • name: Activate AWX Task Container
    docker_container:
    name: awx_task
    state: started
    restart_policy: unless-stopped
    image: "{{ awx_task_docker_actual_image }}"
    **volumes:

It looks like that fixes it.

Is there a method to achieve the same without re-installing?

@summitflier: The explained method didn't work for me in a fresh VM following this GitHub Install manual Docker version. Did you do anything else besides the explanation from @jmarci?
Like re-running in same VM or creating folders manually later, etc?

Thank you.

Related issues: #229, #239

(Let me separate it for better understandig)

Thanks @jmarci !
The explained method by @jmarci worked also for me!

(MY) SOLUTION:
Being able to understand the implications of the solution explained by @jmarci .

As @jmarci wrote:
1.- "/opt/awx_projects" directory is created at host side.
2.- "/opt/awx_projects" is mounted inside both containers (awx_task and awx_web) at "/var/lib/awx/projects".
3.- From that, you only have to copy (or create) a subfolder at "/opt/awx_projects" with your playbooks and/or roles at host side and will be populated to both containers (awx_task and awx_web) inside "/var/lib/awx/projects".
4.- Then, just revisit AWX web interface and try again project creation.
When selecting Manual at "SCM Type" pull down box, will work and copied/created subfolder will appear at new "Playbook Directory" pull down box.
5.- Become HAPPY to have understood/solved the situation (and say thank you).

--
By the way, still wondering how to solve this without reinstalling.
Since I don't know yet about docker in detail, it will take me a while but will share.

2.- "/opt/awx_projects" is mounted inside both containers (awx_task and awx_web) at "/var/lib/awx/projects".

I believe this should be only mounted into awx_task container, not awx_web. There's nothing related to Ansible or SCM projects run inside awx_web.

Hi @savealive,
I set the volume only at the AWX task container and I can say that it doesn't work.

It needs, both, AWX container and AWX task.

It is also explained at Related issues: #229, #239.

In addition, I was concerned on loosing data already created just to be able to allow Manual SCM but,
following @jmarci comments it happens that already created volumes (memcached, postgres and rabbitmq) are not modified. Ansible just adds the volume for AWX Web and Task containers and does nothing else.

So, in this case, just re-installing kept the data already created and only added the volumes to targeted containers.

We do also strongly recommend using scm-based playbooks rather than managing them manually. If you need to manage them manually then you are on your own.

Sorry for commenting on a closed issue but I don't want to open a potential duplicate.

Would official support be forthcoming for @jmarci's solution at all? I have a need to dynamically write the playbooks that I'm executing as the roles may change depending on what needs to be configured. Having access to the projects directory from the host would massively simplify this, but I'd rather not have to make these changes every install/upgrade.

possibly? We are always willing to accept pull requests that implement nice things.

Hi. I am following this issue and after making the changes, AWX works. I am able to create job templates within my existing playbooks. However I am running them, I am not able to load the var files. See error:

PLAY [1.0 Will tell specific versions for cm] **********
TASK [1.0.1 Include Pre-Tasks] ***************
included: /var/lib/awx/projects/playbooks/pretasks.yml for localhost
TASK [Set global fact for base dir] *************
ok: [localhost]
-vvvvv to see paths)
-vvvvv to see paths)
TASK [Get stats on all variable files]
************
TASK [Include all variable files (only when found)] ********
TASK [1.0.2 Check if the target environment 'int' is allowed] *****
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'env in config.environment' failed. The error was: error while evaluating conditional (env in config.environment): 'config' is undefined"}
PLAY RECAP
**********************
localhost : ok=2 changed=0 unreachable=0 failed=1

The play pretasks.yml is trying to read the following configuration files:

    - "{{ base_dir }}/vars/{{ env }}/config.yml"
    - "{{ base_dir }}/vars/global/config.yml"

I am setting the variable base_dir to the following:
base_dir: "{{ lookup('env','PWD') }}"

It seems that it is not able to specify the base_dir in /opt/awx_projects and it is looking in /var/lib/awx so that is why I am getting the errors:
-vvvvv to see paths)
-vvvvv to see paths)

My question is this. How can I make the {{ lookup('env','PWD') }} to read the real project at /opt/awx_projects? Which configuration file in the role should I change? Can this be done also at docker level, if I copy the var files to the docker containers?

Thanks

Note to users landing on this page: the issue was closed, now you just have to uncomment this line in ./installer/inventory:

;project_data_dir=/var/lib/awx/projects

Then re-run ansible-playbook -i inventory install.yml and you're done.

Just to get back on the issue I was refering with the error using "{{ lookup('env','PWD') }}" I was able to solve it by using {{ playbook_dir }} instead

Hello,

Please someone can help me ? I have the same exact issue, i have done what you have explained but when I reinstall, web GUI doesn't work. I have added lines in local_docker/main.yml

When I comment line to mount volume in local_docker/main.yml and reinstall it's work fine.
I have added in inventory
project_data_dir=/opt/awx_projects But I have still the issue.

When I create folder in /opt/awx_projects I can see it in GUI and I can add it but when I click on save I have the issue : Failed to update project: 6. PUT status: 400

Any idea ?

Below step is worked for me
Uncomment the project_data_dir in inventory file & re-run ansible-playbook -i inventory install.yml
./installer/inventory
project_data_dir=/var/lib/awx/projects

@gabrieltokyo Just edit the /root/.awx/awxcompose/docker-compose.yml file and restart the awx container. It will mount your volumes without reinstalling.

Was this page helpful?
0 / 5 - 0 ratings