You only need to change the umask temporarily from the command line before 
reinstalling pywinrm and any other packages that don’t have the right file 
and directory permissions.  You can just type “*umask 022*” before doing 
the package reinstallation to set it.  That will only change the umask 
temporarily in the current session so that you can do the pip install.  If 
you want to change the default umask, there are a few ways to do it that 
are easily found with a web search. 

 

You need to install the pywinrm and requests, and maybe some other packages 
separately for each of the different Python instances on your server that 
you use for Ansible.  Is Ansible configured to use the Python 3 instance 
that you mentioned?  Or is it a Python 2.7 instance?  

 

Either way, make sure that you install it for the Python instance that 
you’re running Ansible with (the instance that *ansible_python_interpreter* 
is set to).  Once you have the permissions right, Ansible should be able to 
access those Python modules.  

 

Below is a SO posting that deals with the permissions issue.  I think if 
you were to look at the files in the Python site-packages directory, you’d 
find that the permissions were set to something like “*-rw-r-----*".   On 
RedHat, I think that will be under */usr/lib/pythonX.x/site-packages/*  (adjust 
for your Python instance)

It would confirm that we're on the right track if those permissions don't 
permit 'read' for others/public user class, as in "*-rw-r--r--*".  

https://stackoverflow.com/questions/36898474/how-to-install-a-module-for-all-users-with-pip-on-linux

 

I have also fixed the permissions issue before by doing a “chmod -R 644” on 
a module's directory and files in site-packages.  Be careful doing this 
though.  

 

Also, any other packages you installed with pip likely have the wrong 
permissions if the umask wasn’t set to 022 at the time of the 
installation.  So you might need to fix them as well.  And remember in the 
future to always set the umask to 022 before doing a pip install.


Hope this helps,


ej

On Tuesday, July 14, 2020 at 1:43:12 PM UTC-6, Eric Holzapfel wrote:
>
> Hello,
> Thanks for the ;reply. I am wondering where I would change the umask 
> value? Just at user level? or system wide?
> I have a similar install with pywinrm, python2, and ansible, and installed 
> pywinrm, and it works fine. It is the red hat server that does not
> find the winrm, urllib3 modules, etc - I can run a python progarm but it 
> needs to be run as sudo.
>
> When I try to install pywinrm (02.2.) on the redhat system it says all 
> dependencies are already met. I am still stumped on how to get redhat winrm 
> to work.
>
> ewholz
>
> P.S. I will check the umask on the Ubuntu server
>
> On Saturday, July 11, 2020 at 6:28:15 AM UTC-7, ej wrote:
>>
>> This sounds like a problem that I ran into before.  Please check your 
>> umask setting.  I suspect it is not 0022.  If it isn't, then trying 
>> uninstalling pywinrm and requests, set the umask to 022, and then reinstall 
>> pywinrm and requests with the umask set.  The modules should then have the 
>> appropriate file and directory permissions so that non-root users can 
>> acccess.
>>
>>
>> On Friday, July 10, 2020 at 1:07:12 PM UTC-6, Eric Holzapfel wrote:
>>>
>>> Hello And Thanks for reply,
>>>
>>> I will try this PIP command (again) but I do not have an RH 
>>> subscription. 
>>>
>>> Also a new symptom, I can run a python program that imports winrm, but I 
>>> get an error "no winrm" if I try
>>> to run the program as a regular user. If I run it as sudo - the python 
>>> program runs, no errors and returns the command from the windows machine.
>>> I was running the "ifconfig /all" .  So as sudo, and running a python 
>>> program that imports winrm, I can access the windows box.
>>>
>>> If I try a basic command line progarm "ansible windows -i hosts -m 
>>> win_ping" as a regular user or as sudo I get the same error:
>>> "no winrm or request module available" What does ansible need to find 
>>> winrm??? Supposedly I have pywinrm installed but cannot
>>> access it.
>>>
>>> On Wednesday, July 8, 2020 at 3:34:35 PM UTC-7, ameya agashe wrote:
>>>>
>>>> Try this,
>>>>
>>>> pip install pywinrm==0.2.2
>>>> If you have RHEL subscription, check this link too
>>>> k this page too
>>>> https://access.redhat.com/solutions/4459791
>>>>
>>>> Cheers
>>>> Ameya Agashe
>>>>
>>>> On Thursday, 9 July 2020 07:42:32 UTC+10, Eric Holzapfel wrote:
>>>>>
>>>>> I have a Redhat Linux server RH7.8 
>>>>>
>>>>> It is running AWX no problem and Ansible no problem as far as LINUX 
>>>>> servers are concerned.
>>>>>
>>>>> I am trying to communicate to a w2k16 server via winrm from my linux 
>>>>> server.
>>>>> The linux box has python3, and pip3 and supposedly pywinrm is 
>>>>> installed.
>>>>>
>>>>> The windows box appears to be setup correctly to listen for winrm 
>>>>> requests.
>>>>> When I try to run  "sudo ansible -i inventory windows -m win_ping" I 
>>>>> get the error that everyone else gets:
>>>>> 10.125.8.56 | FAILED! => {
>>>>>     "msg": "winrm or requests is not installed: No module named winrm"
>>>>>
>>>>> If I check installed packages for requests - it say dependencies are 
>>>>> met. 
>>>>> It also say that pywinrm dependencies are met.
>>>>> What does it take to get the winrm module to be found by python?
>>>>>
>>>>> Thanks
>>>>>
>>>>> ewholz
>>>>>
>>>>
>>>> On Thursday, 9 July 2020 07:42:32 UTC+10, Eric Holzapfel wrote:
>>>>>
>>>>> I have a Redhat Linux server RH7.8 
>>>>>
>>>>> It is running AWX no problem and Ansible no problem as far as LINUX 
>>>>> servers are concerned.
>>>>>
>>>>> I am trying to communicate to a w2k16 server via winrm from my linux 
>>>>> server.
>>>>> The linux box has python3, and pip3 and supposedly pywinrm is 
>>>>> installed.
>>>>>
>>>>> The windows box appears to be setup correctly to listen for winrm 
>>>>> requests.
>>>>> When I try to run  "sudo ansible -i inventory windows -m win_ping" I 
>>>>> get the error that everyone else gets:
>>>>> 10.125.8.56 | FAILED! => {
>>>>>     "msg": "winrm or requests is not installed: No module named winrm"
>>>>>
>>>>> If I check installed packages for requests - it say dependencies are 
>>>>> met. 
>>>>> It also say that pywinrm dependencies are met.
>>>>> What does it take to get the winrm module to be found by python?
>>>>>
>>>>> Thanks
>>>>>
>>>>> ewholz
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2df72899-8156-4de0-a428-15954c26913fo%40googlegroups.com.

Reply via email to