mounted playbook dir in docker

I am running AWX in docker containers and have mounted the playbooks directory (I modified local_docker/tasks/main.yml:“Activate AWX Task Container” to include a volume argument).

I created a directory and a playbook and it shows up inside the container:

$ docker exec -it awx_task /bin/ls -hal /var/lib/awx/projects/helloworld/
total 4.0K
drwxr-xr-x 3 root root 102 Sep 19 18:49 .
drwxr-xr-x 3 root root 102 Sep 19 18:49 …
-rw-r–r-- 1 root root 116 Sep 19 18:38 helloworld.yml

Yet, I still get the warning when I try to create a manual project:

WARNING: There are no available playbook directories in /var/lib/awx/projects. Either that directory is empty, or all of the contents are already assigned to other projects. Create a new directory there and make sure the playbook files can be read by the “awx” system user, or have AWX directly retrieve your playbooks from source control using the SCM Type option above.

The “helloworld” project/playbook also don’t show up when creating a new Job Template.

Is there some special trick to getting AWX to recognize this directory?

thanks,

-MikeB

Does it work without the volume mount if you populate it the same way in a container?

Same behavior. fwiw, I had to create the /var/lib/awx/projects/ directory:

Perhaps silly, but make sure the awx user has access to read the files+directory. In addition, confirm whether SELinux is active and denying access to that file/dir. That may not be the case in the container environment, I don’t recall off hand.

Thanks,
James

I’ve maxed the perms and it’s the same user as the projects that I’ve imported through the UI. Also, there is no ‘awx’ user in the container:

[root@awx projects]# id awx

id: awx: no such user

[root@awx projects]# ls -ahl /var/lib/awx/projects/

total 16K

drwxrwxrwx 4 root root 4.0K Sep 20 14:01 .

drwxrwxr-x 8 root root 4.0K Sep 20 13:47

drwxr-xr-x 7 root root 4.0K Sep 20 13:44 _12__mikeb_test

drwxrwxrwx 2 root root 4.0K Sep 20 13:23 helloworld

Fwiw, this isn’t a must-have because I don’t want to be managing these by hand directly on the system. In production, I want every playbook to be behind git control, in which case, I can install through the GUI. This is more for quick testing and debugging.

I might have an idea, though…

I’m going to try this:

  1. install my global roles on the host machine
  2. mount the global roles as a volume: /opt/myroles/
  3. add an ansible.cfg file to each playbook that specifies role_path=/opt/myroles.

I will report back what happens.

So something you might not realize is that if you have a manual project that projects needs to be put on the web and task nodes… it sounds like you are only putting it on one.

Hello,

Reached same behavior when I try to create a new project using SCM Type=Manual

But in the “awx_web” does not exist any folder called projects (/var/lib/awx/)

I Had to create the folder manually and now runs like a charm!

Thx!

@Guillem so, you had to create /var/lib/awx/projects/ in both awx_task and awx_web?

Where do you put your playbooks? in tasks or web or both?

Same contents?

@Mike Yes! just create the folder projects//.yml same in awx_task and awx_web.

As I said, you have to put them in both.

Hello mike
I am facing the same issue can u please help me for the error. i have tried to create the same directory also but no resoult

WARNING: There are no available playbook directories in /var/lib/awx/projects. Either that directory is empty, or all of the contents are already assigned to other projects. Create a new directory there and make sure the playbook files can be read by the “awx” system user, or have AWX directly retrieve your playbooks from source control using the SCM Type option above

Prashant,

I mounted (as volumes) my projects dir into both the web and task containers. This worked great.

L:201, 231

https://github.com/chepazzo/awx/blob/custom_packages_volumes/installer/local_docker/tasks/main.yml

That branch is a bit outdated, so the code needs to be cleaned up a bit before it could be used with the most recent devel branch, but the concept should remain the same.