Valid venv path choices?

I’m trying to build my first virtualenv, and I keep receiving “is not a valid path choice”. How do I make a choice valid?

Thank you,

Kevin

What have you tried? Share the code you’ve written so we can view it for typos. The error message alone is too vague for us to help with nothing else to go on.

Dan

Thank you, Dan.

The problem is clear to me now, but not the solution. Someone else on my team built this AWX box and got sick just as I tackled this issue. I’m still working to get wet behind the ears.

I built the virtualenv in the Docker host box, but it’s not available to the AWX Docker instance. Somehow, I need to make the virtualenv a part of that instance and I have no clue how.

Thank you, again

Kevin

You need to register the virtualenv via the awx API:
https://docs.ansible.com/ansible-tower/latest/html/upgrade-migration-guide/virtualenv.html
Once you have done that, it should appear as an option in the Job Template page.

BUT - fun thing I found yesterday… where that page strongly recommends you keep the virtualenv somewhere other than /var/lib/awx, the API won’t accept the location UNLESS it is in /var/lib/awx/venv (at least for me with 15.0.1)

Thank you, Howard. I think I’m stuck prior to the solution you present here. I’ll get here someday! Thank you.

Hi Kevin

Like Howard, checkout https://fixes.co.za/ansible/awx-giving-a-project-a-custom-virtual-env-in-container-based-install/#update-use-the-custom_venv_dir-variable
This is what you need to do .

Regards
Phil.

That looks like a thing of beauty. Thank you, Phil!

Thank you again, Phil, but I’m back to the same old square 1. I did the full Ansible document on the Docker host server and at the end, it would not accept my venv folder as a valid venv path choice. I was hopeful the containers would pick up the venv from the host, but that does not happen. And besides, /var/lib/awx does not exist on the host. I created my venv smoothly on the host box, down to the last and happy step, but it doesn’t flow into the containers (which is good, because I distrust magic anyway. Mayhap there’s a config document in which I’m supposed to tell AWX which host files to pick up, but that sounds sketchy.)

So, it appears I need to add the venv on the Task and Web servers, but I cannot find any way to install the gcc there. CentOS8 won’t pull it from the yum repos and I cannot “make” the compiler from tar because doing so needs the compiler. Besides, if I succeeded at this build, would it all not just disappear in the next image refresh, and maybe even in the next restart?

So, my hope again is that I can modify something to make that pickup happen. Looking in the install path I found:
vi /awx/installer/inventory

In it I modified:

AWX custom virtual environment folder. Only usable for local install.

#custom_venv_dir=/opt/my-envs/
custom_venv_dir=/ansible-envs

After making the change and restarting my task and web containers I still get:
{“CUSTOM_VENV_PATHS”:[“/ansible-envs/ is not a valid path choice.”]}

Rereading, but I think I’m snookered. None of this is in my sweet spot. I write playbooks that maintain load balancers. I’ve never issued a yum command outside cut and paste in my life, but if I’m going to automate InfoBlox I’ve got to build the tool. I’m probably missing something dumb, but I’m not seeing it yet.

Kevin

Hi Kevin

Did you manage to solve this in the end? I think this is mostly a permissions issue inside the containers. Try logging into the containers and creating the dirs you want for the venvs. Using openshift I couldn’t do this as it runs as a non-root user and I don’t have the permissions. Using something like /tmp seemed to be ok just to check my assumption.

Phil.

Yep, I am facing similar issue while creating venv inside /opt directory. Directory creation itself is failing due to permission denied . What is the default password for “awx” user for task container ?