Skip to content

How to get Semaphore to see Ansible (no pyhthon venv used) #1249

Closed Answered by jrglynn2
jrglynn2 asked this question in Q&A
Discussion options

You must be logged in to vote

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 using ec2-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 as ec2-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.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jrglynn2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant