semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

winrm or requests is not installed

Open michaelortnersanube opened this issue 1 year ago • 7 comments

Hello,

i want to add Windows Clients my hosts config is this:

[windows_clients] server ansible_host=10.1.1.25

[windows_clients:vars] ansible_connection=winrm ansible_winrm_transport=basic

If i try a run with my playbook i get following error:

fatal: [server]: FAILED! => {"msg": "winrm or requests is not installed: No module named 'winrm'"}

winrm is not installed - can you add this to the docker image from https://hub.docker.com/r/semaphoreui/semaphore

michaelortnersanube avatar Feb 28 '23 11:02 michaelortnersanube

has this been added?

dinvisible1 avatar Jul 07 '23 01:07 dinvisible1

This is a major block for us too... We need windows support, maybe in a seperate docker container?

Are there any issues with the pywinrm and requests packages or why haven't the been already included? I haven't looked at it much, but it seems to be a no brainer to add windows support to semaphores environment...

Square252 avatar Jul 12 '23 13:07 Square252

This might help. Please see this dockerfile I have put together

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

dgibbs64 avatar Jul 19 '23 21:07 dgibbs64

I'd love to see pywinrm module added in the default Docker image too - it's a hassle to handle Windows clients without it and adding it to the container afterwards (especially considering that you'd need to repeat the process after update / container rebuild).

Pshemas avatar Dec 21 '23 14:12 Pshemas

If you prefer not to customize the docker image, you can install directly in your docker compose file using command

command: > sh -c "python3 -m ensurepip --upgrade && pip3 install ansible pywinrm && /usr/local/bin/semaphore-wrapper /usr/local/bin/semaphore server --config /etc/semaphore/config.json"

dreteddy avatar Apr 18 '24 10:04 dreteddy

With a recent change you are able to provide a requirements.txt to install additional python dependencies on container start.

With my pending pr you will also be able to install additional packages at container start.

No need to customize the container anymore.

tboerger avatar Apr 28 '24 19:04 tboerger

I just started working with semaphore and using the docker container. I am using the requirements.txt volume map specified by @tboerger in the comment above and can confirm the pywinrm module was installed. However, it only works if I open the container and run the command by hand, i.e ansible-playbook -vvv /tmp/playbook.yml -i 192.168.1.5, \ --extra-vars 'ansible_connection=winrm ansible_port=5985 ansible_user=administrator ansible_password=pass123' When I run it in the Semaphore UI, I continue to get No module named 'winrm'

I assume some type of path/env setting is not set in the UI after the plugin is installed?

UPDATE: I have found that if I update the /etc/semaphore/config.json value tmp_path as shown below, the winrm module is now found. Hope this helps someone. OLD: "tmp_path": "/tmp/semaphore", NEW: "tmp_path": "/home/semaphore",

mtcoffee avatar May 07 '24 01:05 mtcoffee