semaphoreui / semaphore

Modern UI and powerful API for Ansible, Terraform, OpenTofu, PowerShell and other DevOps tools.
https://semaphoreui.com
MIT License
10.61k stars 1.07k forks source link

winrm or requests is not installed #1175

Open michaelortnersanube opened 1 year ago

michaelortnersanube commented 1 year ago

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

dinvisible1 commented 1 year ago

has this been added?

Square252 commented 1 year ago

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...

dgibbs64 commented 1 year ago

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
Pshemas commented 10 months ago

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).

dreteddy commented 6 months ago

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"

tboerger commented 6 months ago

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.

mtcoffee commented 6 months ago

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",