Connection to Windows Machines with embedded ansible


#1

Hi,

Trying to use a playbook with the embedded ansible to create a button for installing software for Windows machines, but it seems like pywinrm is not installed by default in the red hat provided appliance.

Version: 5.9.1.2.20180321221247_67fd99d

When I try to install any python modules, dependencies conflicts start all over.

Do you know if this is by design or am I missing something?

Thanks!


#2

Ok. There is this RFE https://bugzilla.redhat.com/show_bug.cgi?id=1558193

In there it is said that users should manually install this functionality if they want it :confused:

In any case, trying to install pywin and/or pywinrm fails. Any tip or help on this subject please?

The errors are as follow:

ERROR AFTER PIP INSTALL PYWIN

[root@cloudforms ~]# pip install pywin
Collecting pywin
Using cached https://files.pythonhosted.org/packages/23/f5/744fc05b39ab479749c2eb9ba5cdf57b932a41a0bc23d833a47cb6314638/pywin-0.3.1.zip
Complete output from command python setup.py egg_info:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-rx47U7/pywin/setup.py”, line 4, in
use_setuptools()
File “distribute_setup.py”, line 152, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File “distribute_setup.py”, line 131, in _do_download
to_dir, download_delay)
File “distribute_setup.py”, line 201, in download_setuptools
src = urlopen(url)
File “/usr/lib64/python2.7/urllib2.py”, line 154, in urlopen
return opener.open(url, data, timeout)
File “/usr/lib64/python2.7/urllib2.py”, line 437, in open
response = meth(req, response)
File “/usr/lib64/python2.7/urllib2.py”, line 550, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib64/python2.7/urllib2.py”, line 475, in error
return self._call_chain(*args)
File “/usr/lib64/python2.7/urllib2.py”, line 409, in _call_chain
result = func(*args)
File “/usr/lib64/python2.7/urllib2.py”, line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: SSL is required

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-rx47U7/pywin/

ERROR AFTER PIP INSTALL PYWINRM

[root@cloudforms ~]# pip install pywinrm
Collecting pywinrm
Using cached https://files.pythonhosted.org/packages/0d/12/13a3117bbd2230043aa32dcfa2198c33269665eaa1a8fa26174ce49b338f/pywinrm-0.3.0-py2.py3-none-any.whl
Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from pywinrm) (1.9.0)
Collecting requests-ntlm>=0.3.0 (from pywinrm)
Using cached https://files.pythonhosted.org/packages/03/4b/8b9a1afde8072c4d5710d9fa91433d504325821b038e00237dc8d6d833dc/requests_ntlm-1.1.0-py2.py3-none-any.whl
Collecting requests>=2.9.1 (from pywinrm)
Using cached https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Collecting xmltodict (from pywinrm)
Using cached https://files.pythonhosted.org/packages/42/a9/7e99652c6bc619d19d58cdd8c47560730eb5825d43a7e25db2e1d776ceb7/xmltodict-0.11.0-py2.py3-none-any.whl
Requirement already satisfied: cryptography>=1.3 in /usr/lib64/python2.7/site-packages (from requests-ntlm>=0.3.0->pywinrm) (1.7.2)
Collecting ntlm-auth>=1.0.2 (from requests-ntlm>=0.3.0->pywinrm)
Using cached https://files.pythonhosted.org/packages/8e/5b/4047779fb456b0de503c4acb7b166becf2567efb772abb53998440791d3c/ntlm_auth-1.2.0-py2.py3-none-any.whl
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->pywinrm) (2018.4.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->pywinrm) (3.0.4)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->pywinrm) (1.23)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/lib/python2.7/site-packages (from requests>=2.9.1->pywinrm) (2.7)
Requirement already satisfied: pyasn1>=0.1.8 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm) (0.4.3)
Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm) (0.9.8)
Requirement already satisfied: enum34 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm) (1.0.4)
Requirement already satisfied: ipaddress in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm) (1.0.16)
Requirement already satisfied: cffi>=1.4.1 in /usr/lib64/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm) (1.6.0)
Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm) (2.14)
ipapython 4.5.0 requires pyldap>=2.4.15, which is not installed.
ipapython 4.5.0 has requirement dnspython>=1.15, but you’ll have dnspython 1.12.0 which is incompatible.
Installing collected packages: requests, ntlm-auth, requests-ntlm, xmltodict, pywinrm
Found existing installation: requests 2.6.0
Cannot uninstall ‘requests’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Thanks,


#3

Cloudforms uses AWX (Upstream Project of Ansible Tower) to run its Embedded Ansible scripts and AWX creates two python vitualenvs (https://virtualenv.pypa.io/en/stable/)

Therefore there are 3 Python environments (System, AWX itself, Ansible-Engine where all the playbooks run) on the Appliance. You have to install pywinrm into the ansible-virtualenv (in /var/lib/awx/venv/ansible/).

There is also another error:

urllib2.HTTPError: HTTP Error 403: SSL is required

Which looks like this stack overflow issue: https://stackoverflow.com/questions/46967488/getting-error-403-while-installing-package-with-pip#46979531


#4

That looks exactly what I was looking for :slight_smile: I’ll be able to try it during this week and I’ll post the results here so others facing the same problem can use your proven suggestion!

Thank you very much!