[GH-ISSUE #86] [BUG] Missing dependency pexpcet #42

Closed
opened 2026-03-03 13:58:38 +03:00 by kerem · 3 comments
Owner

Originally created by @jfbette on GitHub (Aug 23, 2020).
Original GitHub issue: https://github.com/konstruktoid/hardening/issues/86

Originally assigned to: @konstruktoid on GitHub.

Describe the bug
I am trying to use your role on an Raspbian. I experienced the following error :

TASK [konstruktoid.hardening : initialize Debian aide] ****************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named pexpect
fatal: [hostname]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (pexpect) on pi2's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}

You use expect directive in the task "TASK [konstruktoid.hardening : initialize Debian aide]" but sometime the package python-pexpect is missing. Install it on dependencies and all will be fine. This is a requirement according to Ansible documentation

To Reproduce
Use raspbian system

System (lsb_release -a):
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

Originally created by @jfbette on GitHub (Aug 23, 2020). Original GitHub issue: https://github.com/konstruktoid/hardening/issues/86 Originally assigned to: @konstruktoid on GitHub. **Describe the bug** I am trying to use your role on an Raspbian. I experienced the following error : TASK [konstruktoid.hardening : initialize Debian aide] **************************************************************************************************************************************************** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named pexpect fatal: [hostname]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (pexpect) on pi2's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"} You use expect directive in the task "TASK [konstruktoid.hardening : initialize Debian aide]" but sometime the package python-pexpect is missing. Install it on dependencies and all will be fine. This is a requirement according to [Ansible documentation](https://docs.ansible.com/ansible/latest/modules/expect_module.html) **To Reproduce** Use raspbian system **System (lsb_release -a):** lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster
kerem closed this issue 2026-03-03 13:58:38 +03:00
Author
Owner

@konstruktoid commented on GitHub (Aug 24, 2020):

I believe this should be a bug in https://github.com/konstruktoid/ansible-role-hardening instead, but https://github.com/konstruktoid/ansible-role-hardening/blob/master/tasks/01_pre.yml#L69-L83 should have taken care of that dependency.
Are you able to install python-pexpect manually?

<!-- gh-comment-id:678927004 --> @konstruktoid commented on GitHub (Aug 24, 2020): I believe this should be a bug in https://github.com/konstruktoid/ansible-role-hardening instead, but https://github.com/konstruktoid/ansible-role-hardening/blob/master/tasks/01_pre.yml#L69-L83 should have taken care of that dependency. Are you able to install `python-pexpect` manually?
Author
Owner

@jfbette commented on GitHub (Aug 24, 2020):

Hi,

Sorry for the bug reported in the wrong repo.
In fact I used your role through the ansible-galaxy and it seems that it is an old source code as i don't see the installation of python-pexpect as you do in https://github.com/konstruktoid/ansible-role-hardening/blob/master/tasks/01_pre.yml#L69-L83.

I close the bug, sorry for the inconvenience

<!-- gh-comment-id:678946659 --> @jfbette commented on GitHub (Aug 24, 2020): Hi, Sorry for the bug reported in the wrong repo. In fact I used your role through the ansible-galaxy and it seems that it is an old source code as i don't see the installation of python-pexpect as you do in [ https://github.com/konstruktoid/ansible-role-hardening/blob/master/tasks/01_pre.yml#L69-L83](https://github.com/konstruktoid/ansible-role-hardening/blob/master/tasks/01_pre.yml#L69-L83). I close the bug, sorry for the inconvenience
Author
Owner

@konstruktoid commented on GitHub (Aug 24, 2020):

Good catch anyway @jfbette, I'll update the galaxy version soon.

<!-- gh-comment-id:679009361 --> @konstruktoid commented on GitHub (Aug 24, 2020): Good catch anyway @jfbette, I'll update the galaxy version soon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hardening#42
No description provided.