ansible kerberos library is not installed

not sure what happened but this was working last week.

now I am getting this error

tony@ubuntu:~/windows$ ansible windows -i hosts -m win_ping -vvvvvvvvv
ansible 2.9.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/home/tony/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /home/tony/.local/lib/python2.7/site-packages/ansible
executable location = /home/tony/.local/bin/ansible
python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/tony/windows/hosts as it did not pass its verify_file() method
script declined parsing /home/tony/windows/hosts as it did not pass its verify_file() method
auto declined parsing /home/tony/windows/hosts as it did not pass its verify_file() method
Parsed /home/tony/windows/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /home/tony/.local/lib/python2.7/site-packages/ansible/plugins/callback/minimal.pyc
META: ran handlers
Using module file /home/tony/.local/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1
Using module file /home/tony/.local/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1
Pipelining is enabled.
Pipelining is enabled.
ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@xxxx on PORT 5986 TO pa-mgt01
<rw-ctxweb-02> ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@xxxxx on PORT 5986 TO rw-ctxweb-02
pa-mgt01.wsgr.com | UNREACHABLE! => {
“changed”: false,
“msg”: “kerberos: the python kerberos library is not installed”,
“unreachable”: true
}
rw-ctxweb-02.wsgr.com | UNREACHABLE! => {
“changed”: false,
“msg”: “kerberos: the python kerberos library is not installed”,
“unreachable”: true

any idea? I cant connect to my windows machines now and winrm is setup correctly

maybe I am missing krb?

tony@ubuntu:~/windows$ sudo apt install -y krb5-user libpam-krb5 libpam-ccreds auth-client-config
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
krb5-user : Depends: libkrb5-3 (= 1.16-2ubuntu0.1) but 1.16-2ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.

any ieea? I am able to chem ntlm auth is working fine. its just kerberos is failed

I would advise speaking to your AD Team or your GPO Administrator, They may have updated their GPO Policies to stop communication over the ports used for Kerberos: This Issue doesn’t seem to be an Ansible issue but an issue with your Environment setup.

The error message is saying

The python kerberos library is not installed

Make sure you have installed pykerberos by running ‘pip install pykerberos’ or if you are managing Python packages through your system package manager ‘apt install python-kerberos’.

You can verify whether it is installed with ‘python -c “import kerberos”’. Make sure the Python you use to execute this check is the same Python that Ansible runs with.

Thanks

Jordan

getting this error

tony@ubuntu:~$ sudo pip install pykerberos
[sudo] password for tony:
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
WARNING: The directory ‘/home/tony/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting pykerberos
Downloading pykerberos-1.2.1.tar.gz (24 kB)
Building wheels for collected packages: pykerberos
Building wheel for pykerberos (setup.py) … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-sZaCg1/pykerberos/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-sZaCg1/pykerberos/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ bdist_wheel -d /tmp/pip-wheel-sAbKUA
cwd: /tmp/pip-install-sZaCg1/pykerberos/
Complete output (14 lines):
running bdist_wheel
running build
running build_ext
building ‘kerberos’ extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-UKCoZ3/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/kerberos.c -o build/temp.linux-x86_64-2.7/src/kerberos.o
In file included from src/kerberos.c:19:
src/kerberosbasic.h:17:10: fatal error: gssapi/gssapi.h: No such file or directory
#include <gssapi/gssapi.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

getting this error

tony@ubuntu:~$ sudo pip install pykerberos

Why use sudo?

WARNING: The directory '/home/tony/.cache/pip' or its parent directory is
not owned or is not writable by the current user. The cache has been
disabled. Check the permissions and owner of that directory. If executing
pip with sudo, you may want sudo's -H flag.

Regards,

Antony.

Please read the docs, there are a few packages that need to be installed for pip to compile the pykerberos library https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#installing-the-kerberos-library.

this is error i keep getting

tony@ubuntu:~$ pip install pykerberos
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
Defaulting to user installation because normal site-packages is not writeable
Collecting pykerberos
Downloading pykerberos-1.2.1.tar.gz (24 kB)
Building wheels for collected packages: pykerberos
Building wheel for pykerberos (setup.py) … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-e0nO8N/pykerberos/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-e0nO8N/pykerberos/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ bdist_wheel -d /tmp/pip-wheel-CFz0Gh
cwd: /tmp/pip-install-e0nO8N/pykerberos/
Complete output (14 lines):
running bdist_wheel
running build
running build_ext
building ‘kerberos’ extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-UKCoZ3/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/kerberos.c -o build/temp.linux-x86_64-2.7/src/kerberos.o
In file included from src/kerberos.c:19:
src/kerberosbasic.h:17:10: fatal error: gssapi/gssapi.h: No such file or directory
#include <gssapi/gssapi.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

At his point, I'd try something like "apt-get -f install" to fix the
installed packages.

Obviously some executable is invoked here, and it depends on another
operating system package. The required package is named libkrb5-3 and
should have version 1.16-2ubuntu0.1, but there seems to be only version
1.16-2ubuntu1.1 available.

Try to fix this, since all the following output should depend on that.

HTH, Werner