mounted playbook dir in docker

2,098 views
Skip to first unread message

Mike Biancaniello

unread,
Sep 19, 2017, 5:03:38 PM9/19/17
to AWX Project
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

Matthew Jones

unread,
Sep 19, 2017, 8:53:28 PM9/19/17
to Mike Biancaniello, AWX Project
Does it work without the volume mount if you populate it the same way in a container?

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/dbc64ab7-87fd-496f-a3b6-34aa0735549d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Matt Jones
Principal Software Engineer
Ansible Tower

Mike Biancaniello

unread,
Sep 20, 2017, 9:28:37 AM9/20/17
to AWX Project
Same behavior. fwiw, I had to create the /var/lib/awx/projects/ directory:


$ docker exec -it awx_task /bin/bash

[root@awx awx]# ll /var/lib/awx/projects/

ls: cannot access /var/lib/awx/projects/: No such file or directory


James Laska

unread,
Sep 20, 2017, 9:48:52 AM9/20/17
to Mike Biancaniello, AWX Project
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

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.

Mike Biancaniello

unread,
Sep 20, 2017, 10:16:18 AM9/20/17
to AWX Project
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.

Matthew Jones

unread,
Sep 20, 2017, 10:19:00 AM9/20/17
to Mike Biancaniello, AWX Project
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.

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Guillem Lozano

unread,
Sep 20, 2017, 10:33:01 AM9/20/17
to AWX Project
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!

On Wednesday, September 20, 2017 at 4:19:00 PM UTC+2, Matthew Jones wrote:
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.
On Wed, Sep 20, 2017 at 10:16 AM, Mike Biancaniello <chep...@gmail.com> wrote:
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.

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.

To post to this group, send email to awx-p...@googlegroups.com.

Mike Biancaniello

unread,
Sep 20, 2017, 10:36:58 AM9/20/17
to AWX Project
@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?

Mike Biancaniello

unread,
Sep 20, 2017, 10:37:27 AM9/20/17
to AWX Project
Same contents?

Guillem Lozano

unread,
Sep 20, 2017, 10:42:26 AM9/20/17
to AWX Project
@Mike Yes! just create the folder projects/<project>/<playbook>.yml same in awx_task and awx_web.

On Wednesday, September 20, 2017 at 4:37:27 PM UTC+2, Mike Biancaniello wrote:
Same contents?

Matthew Jones

unread,
Sep 20, 2017, 10:42:46 AM9/20/17
to Mike Biancaniello, AWX Project
As I said, you have to put them in both.

On Wed, Sep 20, 2017 at 10:37 AM, Mike Biancaniello <chep...@gmail.com> wrote:
Same contents?

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Prashant Solanki

unread,
Nov 25, 2017, 5:42:51 AM11/25/17
to AWX Project
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

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Mike Biancaniello

unread,
Nov 26, 2017, 12:40:19 PM11/26/17
to AWX Project
Prashant,

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

L:201, 231


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.
Reply all
Reply to author
Forward
0 new messages