Open jsinic opened 2 years ago
What Semaphore installation do you use (snap, docker or binary)?
I use snap.
Same issue using Snap installer.
I use the docker install and getting the same issue.
I also encountered the same situation using docker. As I understand it, openshift uses the docker image too, it should probably have the same return.
Probably when trying to connect using psrp you will get a message similar to “Failed to connect to the host via PSRP”, because it is necessary to include pypsrp.
WinRM and PSRP are part of ansible-core and are included with all Ansible installations, but the pywinrm and pypsrp requirements are required on the local controller node that makes this connection.
For docker I believe it is possible to change the Dockerfile and include py3-pip, pywinrm and/or pypsrp.
I changed the Dockerfile:
RUN apk add --no-cache sshpass git curl ansible py3-pip mysql-client openssh-client tini && \
adduser -D -u 1001 -G root semaphore && \
pip3 install pywinrm && \
pip3 install pypsrp && \
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore
I created three images to compare with the prod-compose image:
context=prod tag=winrm-psrp task docker:build
context=prod tag=psrp task docker:build
context=prod tag=winrm task docker:build
Result:
REPOSITORY TAG IMAGE ID CREATED SIZE
ansiblesemaphore/semaphore prod-compose c92d8c1395be 2 minutes ago 447MB
ansiblesemaphore/semaphore winrm 74e585559e3f 8 minutes ago 463MB
ansiblesemaphore/semaphore psrp 50600db239f8 23 minutes ago 464MB
ansiblesemaphore/semaphore winrm-psrp 5e7df09b83de 34 minutes ago 465MB
The image size has increased by approximately 18MB.
I believe that to include it in the Snap installer or binary it is necessary to change the ansible-semaphore-snap/snapcraft.yaml:
ansible:
plugin: python
source: .
build-packages:
- python3-venv
- python3-dev
stage-packages:
- python3-venv
override-build: |
python3 -m venv ansible_env
export PATH=ansible_env/bin:$PATH
CRYPTOGRAPHY_DONT_BUILD_RUST=1
pip3 install --upgrade pip
pip3 install setuptools_rust wheel setuptools botocore boto3
pip3 install ansible
pip3 install pywinrm
pip3 install pypsrp
tar cfz ansible_env.tar.gz ansible_env
cp ansible_env.tar.gz $SNAPCRAFT_PART_INSTALL
Both support basic, certificate and NTLM authentication, but to use Kerberos or CredSSP extra libraries are still needed.
If this is correct, is it possible that the semaphore project includes support for winrm, psrp, or both?
It would be nice to add pywinrm to docker container. Because now it is needed to build my own image before usage. Thanks in advance.
Could you try to install via ansible role?
Example Role: https://github.com/fiftin/ansible-semaphore-deploy-test/blob/master/roles/deps/tasks/main.yml Playbook: https://github.com/fiftin/ansible-semaphore-deploy-test/blob/master/deps.yml
I'm using this image in K8s cluster. That's why I need this package in Semaphore container.
So... I am trying first time semaphore as I love ansible but need some noobs around me to love it too so need UI and its for win targets
I am using docker compose
Will this get fixed by the official docker image? Or does anyone have publicly available image containing those winrm python dependencies?
Hello! we also use the semaphore docker image as an azure web app. and we are running it to the same error.
As @edineicolli are pointing out it an easy fix to get ansible-semaphore to work with windows host, over powershell remote/winrm.
its just to pip3 install pywinrm && pip3 install pypsrp
during the build of the official docker image, i have try to found it in this repo but no luck. Any one knowing the location of the Dockerfile?
Likned issues are: 1175
I hope we can see a update on this ASAP
Best regards
@urskog84 Dockerfile is here.
https://github.com/ansible-semaphore/semaphore/blob/develop/deployment/docker/prod/Dockerfile
Looks like the problem is still open.
Ubuntu 22.04.3 Snap Installer
I solved this by folowing @cfredericksen example.
FROM semaphoreui/semaphore:latest
USER root
RUN apk add --no-cache python3 py3-pip
RUN pip install pywinrm jmespath netaddr passlib requests matrix_client
USER semaphore
ADD config.json /etc/semaphore/
Hello, I am new to managing Ansible, as well as Semaphore UI. I am trying to manage Windows machines using WINRM from Semaphore, which I installed using Docker Desktop. After configuring it, I couldn't get it to ping the Windows machines. The only way I found is to enter the Semaphore container terminal as root and install the necessary packages with the following commands:
apk add py3-pip pip install pywinrm
This way, I managed to handle my Windows machines from Semaphore. I apologize if what I'm posting is not relevant; I'm just trying to learn how to manage Ansible and Semaphore.
Hello there,
I am not sure if my analysis of this issue is correct, but I managed to fix it. If there is any other solution please share!
The snap file of semaphore uses core20 as the base snap, which is the base for Ubuntu 20.04, and it has python 3.8 by default, I assume that is because semaphore expects 3.8 to be used.
Also, the snap requires python3, wihout specifying the version. This means that if you install python3 using another version of ubuntu as in my case, 24.04, the default version of python is 3.12. The cause of this will be that 2 lib folders will be created for both versions.
When the dependencies packages get's installed, they will do in the 3.12 folder, but semaphore will only look into the 3.8.
Short term solution, specifically install the package in the 3.8 folder. Not ideal, but it works.
cd /root/snap/semaphore/common/ansible_env/bin
source ./activate
# Just in case, uninstall it
./python3 -m pip uninstall requests
./python3 -m pip uninstall pywinrm
./python3 -m pip install --target=../lib/python3.8/site-packages/ pywinrm
./python3 -m pip install --target=../lib/python3.8/site-packages/ requests
As the permanent solution, the snapcraft file would need to be updated to get the desired python version.
Hi
I have problems with running task template in Semaphore GUI.
fatal: [IP_ADRESS]: FAILED! => msg: 'winrm or requests is not installed: No module named ''winrm'''
If i run same playbook and same host in the CLI mode it works.
My specs are: ansible 2.7.0 python version = 3.6.8 (default, Nov 9 2021, 14:44:26) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] Semaphore version 2.8.53
Do you have any advices how to solve this issue?