-
Hi all, I updated a seemingly relevant issue last week (Issue #1075), but since no one has acknowledged it, I am second guessing whether that was the proper place to post. So, I thought I would try to get answers here. As described in my comment in the Issue: I just installed semaphore, and am getting the same error regarding "no module".
I do not use venv for either semaphore or ansible. Running ansible commands from the command line works fine, but it seems like Semaphore doesn't see ansible for some reason. You can see that it finds ansible-playbook, but ansible-playbook then can't seem to find ansible. Here is my systemd service file. I tried adding the Environment line, which is a copy of my normal path, and ec2-user is the user we use to run ansible commands from server command line.
Any help is greatly appreciated! Thanks! --jrglynn2 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found a solution for this issue. Ansible for me was installed as a user ( In order to get the proper path to use for PYTHONPATH, I ran So, I ended up adding this line to my service file: Closing discussion. |
Beta Was this translation helpful? Give feedback.
I found a solution for this issue.
Ansible for me was installed as a user (
executable location = /home/ec2-user/.local/bin/ansible
) . For some reason usingec2-user
as User & Group in the service file wasn't enough, so I had to add a PYTHONPATH variable (https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH).In order to get the proper path to use for PYTHONPATH, I ran
python -c "import site; print(site.USER_SITE)"
when logged in asec2-user
.So, I ended up adding this line to my service file:
Environment=PYTHONPATH=/home/ec2-user/.local/lib/python3.9/site-packages
Closing discussion.