semaphore
semaphore copied to clipboard
Installed Python Packages are not found
Hello,
I'm currently just trying out semaphore to get a GUI for Ansible, to create kind of a self service portal. Right now I'm facing a problem, and I can't quite grasp where the problem is.
I've created a dockerfile to install the needed Python Packages and Ansible Collections. I'm than using the created image in my docker-compose.yml. That's all working. But as soon as I start to run a playbook, I get an error that a package couldn't be loaded. In this case it was requests. But I've installed it into the container. So I'm not sure why it can't be loaded.
Best regards, HerrFrodo
Did you install the package globally (as root) or as the semaphore user? Have you installed those dependencies via pip?
I've installed the packages as the sempahore user with pip.
I also tried modifying the path in my Dockerfile, but that also didn't help
ENV PATH="${PATH}:/home/semaphore/.local/bin"
I'm not sure if this works. Would you be able to share the dockerfile you based your container on? Just for proof reading. I've done similar to solve some depenendency and tooling issues I had in my setup.
You can install packages to container via Ansible :)
I'm not sure if this works. Would you be able to share the dockerfile you based your container on? Just for proof reading. I've done similar to solve some depenendency and tooling issues I had in my setup.
Of course, there you go.
FROM semaphoreui/semaphore:latest
USER root
#Install PIP
RUN apk add py3-pip
#Switch to Semaphore User
USER semaphore
#Echo the current Path Variable
RUN echo $PATH
#Add the semaphore user bins to the path
ENV PATH="${PATH}:/home/semaphore/.local/bin"
#Echo the current Path Variable
RUN echo $PATH
#Install Python Dependencies
RUN pip3 install certifi
RUN pip3 install cffi
RUN pip3 install chardet
RUN pip3 install cryptography
RUN pip3 install idna
RUN pip3 install Jinja2
RUN pip3 install MarkupSafe
RUN pip3 install ntlm-auth
RUN pip3 install packaging
RUN pip3 install pycparser
RUN pip3 install pyparsing
RUN pip3 install pyvmomi
RUN pip3 install pywinrm
RUN pip3 install PyYAML
RUN pip3 install requests
RUN pip3 install requests-ntlm
RUN pip3 install resolvelib
RUN pip3 install semantic-version
RUN pip3 install setuptools-rust
RUN pip3 install six
RUN pip3 install toml
RUN pip3 install urllib3
RUN pip3 install xmltodict
#Install Ansible Dependencies
RUN ansible-galaxy collection install community.vmware
RUN ansible-galaxy collection install community.windows
RUN ansible-galaxy collection install chocolatey.chocolatey
You can install packages to container via Ansible :)
@fiftin - Could you please provide an example for how this is done for vanilla semaphoreui/semaphore:latest image? I assume the playbook must target localhost (the container) and first run apk add py3-pip but this requires sudo and this doesn't appear to be installed in the container?
Please use the latest container image (currently develop tag) where you can install any pypi dependency by mounting a requirements.txt to /etc/semaphore.