Windows node control error

148 views
Skip to first unread message

Sathishs Subramani

unread,
Jan 20, 2023, 12:07:40 PM1/20/23
to rundeck-discuss
ERROR! Unexpected Exception, this is probably a bug: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/idna-2.6.dist-info/METADATA'
the full traceback was:
Traceback (most recent call last):
File "/bin/ansible", line 92, in <module>
mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
File "/usr/lib/python2.7/site-packages/ansible/cli/__init__.py", line 22, in <module>
from ansible.inventory.manager import InventoryManager
File "/usr/lib/python2.7/site-packages/ansible/inventory/manager.py", line 38, in <module>
from ansible.plugins.loader import inventory_loader
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 23, in <module>
from ansible.parsing.utils.yaml import from_yaml
File "/usr/lib/python2.7/site-packages/ansible/parsing/utils/yaml.py", line 17, in <module>
from ansible.parsing.yaml.loader import AnsibleLoader
File "/usr/lib/python2.7/site-packages/ansible/parsing/yaml/loader.py", line 30, in <module>
from ansible.parsing.yaml.constructor import AnsibleConstructor
File "/usr/lib/python2.7/site-packages/ansible/parsing/yaml/constructor.py", line 30, in <module>
from ansible.parsing.vault import VaultLib
File "/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py", line 45, in <module>
from cryptography.hazmat.backends import default_backend
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
import pkg_resources
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3007, in <module>
working_set.require(__requires__)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 728, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 631, in resolve
requirements.extend(dist.requires(req.extras)[::-1])
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2489, in requires
dm = self._dep_map
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2700, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2722, in _compute_dependencies
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2692, in _parsed_pkg_info
self._pkg_info = Parser().parsestr(self.get_metadata(self.PKG_INFO))
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1421, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1536, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/idna-2.6.dist-info/METADATA'

rac...@rundeck.com

unread,
Jan 20, 2023, 1:08:28 PM1/20/23
to rundeck-discuss
Hi Satish,

That error is different from your last thread, it seems an integrity problem in your operating system,  check carefully if the rundeck user can reach the python 3 / pip tools. Probably a good approach is to test a fresh installation in a virtual machine following the guides provided in the last threads (this one for basic integration and this one for windows specific target nodes).

Digging around that, are you working with python virtual envs? If so, keep in mind this issue (marked as enhacement request)

Greetings.

Sathishs Subramani

unread,
Jan 21, 2023, 11:21:17 AM1/21/23
to rundeck-discuss
Hi, 

I have tried fresh installation with below steps

curl https://raw.githubusercontent.com/rundeck/packaging/main/scripts/rpm-setup.sh 2> /dev/null | sudo bash -s rundeck

yum install rundeck

service rundeckd start

tail -f /var/log/rundeck/service.log

groups rundeck

yum install java

tail -f /var/log/rundeck/service.log

java -version

systemctl status rundeckd

tail -f /var/log/rundeck/service.log

systemctl status rundeckd

yum install ansible

wget https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.9.6-1.el7.ans.noarch.rpm

yum install ansible-2.9.6-1.el7.ans.noarch.rpm 

ansible --version

cd /etc/ansible/

vim hosts

vim /etc/config/rundeck-config.properties

vim /etc/rundeck/rundeck-config.properties 

vim framework.properties

vim /etc/rundeck/framework.properties 

systemctl restart rundeckd

pip install pywinrm

yum install epel-release

yum install python-pip

pip -V

pip install pywinrm

pip install --upgrade pip

yum install gcc python-devel krb5-devel krb5-workstation python-devel

yum install python-requests

python -V

wget https://bootstrap.pypa.io/pip/2.7/get-pip.py

python get-pip.py

pip install pywinrm

pip list

Package                          Version

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

ansible                          2.9.6

Babel                            0.9.6

backports.ssl-match-hostname     3.5.0.1

certifi                          2021.10.8

cffi                             1.6.0

chardet                          4.0.0

cloud-init                       19.4

configobj                        4.7.2

cryptography                     1.7.2

decorator                        3.4.0

enum34                           1.0.4

ethtool                          0.8

futures                          3.1.1

idna                             2.10

iniparse                         0.4

ipaddr                           2.1.11

ipaddress                        1.0.16

IPy                              0.75

javapackages                     1.0.0

Jinja2                           2.7.2

jsonpatch                        1.2

jsonpointer                      1.9

kitchen                          1.1.1

lxml                             3.2.1

M2Crypto                         0.21.1

Magic-file-extensions            0.2

MarkupSafe                       0.11

netifaces                        0.10.4

paramiko                         2.1.1

pciutils                         1.7.3

perf                             0.1

pexpect                          2.3

pip                              20.3.4

ply                              3.4

policycoreutils-default-encoding 0.1

prettytable                      0.7.2

pyasn1                           0.1.9

pycparser                        2.14

pycurl                           7.19.0

pygobject                        3.22.0

pygpgme                          0.3

pyinotify                        0.9.4

pyliblzma                        0.5.3

pyOpenSSL                        0.13.1

pyserial                         2.6

python-dateutil                  1.5

python-dmidecode                 3.10.13

python-linux-procfs              0.4.9

pyudev                           0.15

pyxattr                          0.5.1

PyYAML                           3.10

requests                         2.6.0

rhnlib                           2.5.65

schedutils                       0.4

seobject                         0.1

sepolicy                         1.1

setuptools                       0.9.8

six                              1.9.0

slip                             0.4.0

slip.dbus                        0.4.0

subscription-manager             1.24.51

syspurpose                       1.24.51

urlgrabber                       3.10

urllib3                          1.26.14

virtualenv                       15.1.0

wheel                            0.37.1

yum-metadata-parser              1.1.4


# cat /var/lib/rundeck/projects/Windows/resources.xml 

<?xml version="1.0" encoding="UTF-8"?>

<project>

<node name="Hostname"

   description="Windows Server"

   tags="ad"

   hostname="Hostname"

   osArch="amd64"

   osFamily="windows"

   osName="Windows Server 2019"

   osVersion="6.3"

   username="rundeckuser"

   winrm-password-storage-path="keys/windows.password"

   winrm-authtype="basic"

   node-executor="WinRMPython"

   file-copier="WinRMcpPython"

/>

</project>


Getting this error now

[ERROR ] request and urllib3 not installed, try: pip install requests && pip install urllib3 (winrm-exec.py:230)[root]
Failed: NonZeroResultCode: [WinRMPython] Result code: 1

I could see above both packages are already installed it

# pip install requests && pip install urllib3 

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.

Requirement already satisfied: requests in /usr/lib/python2.7/site-packages (2.6.0)

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.

Requirement already satisfied: urllib3 in /usr/lib/python2.7/site-packages (1.26.14)

I am not familiar with  python virtual envs?. Please help me. how to resolve to control windows servers from rundeck

Note: I have tried with python3 also but same kind of error coming out. 

rac...@rundeck.com

unread,
Jan 23, 2023, 9:00:02 AM1/23/23
to rundeck-discuss
Hi Satish,

I see you're trying to connect to Windows using the PyWinRM plugin (not via Ansible integration). In the PyPywinRM node executor, you can select the right Python interpreter in the PyWinRM executor (e.g: some Linux distros use the "python" to refer to the python3 interpreter), and based on that you can define the right pip3 modules using the "rundeck" user (Project Settings > Edit Configuration > Select "WinRM Node Executor Python" and then, you can define the interpreter in the "python interpreter" dropdown list). Check this comment, is the same issue.

Another point and very important is to configure your windows boxes to "receive" the WinRM protocol request, for that take a look at this.

You can test the WinRM connectivity using a script like this.

Regards.
Reply all
Reply to author
Forward
0 new messages