How to add Modules?
corincorvus opened this issue · comments
Hi,
i tried to build in the modules with a new image, but it didnt work (modules are not found).
how i can add modules like proxmox and matrix?
I already add a requirements.txt for the python "matrix-client" and i installed the modules with a playbook in my persistant path.
---
- name: Installieren und Konfigurieren von Ansible-Modulen
hosts: localhost # oder deine Ansible-Zielgruppe
#become: true # Verwende sudo/Root-Rechte, wenn nötig
tasks:
- name: Installiere Proxmox-Modul
pip:
name: proxmoxer
extra_args: "--target /opt/ansible-modules"
- name: Installiere Matrix-Modul
pip:
name: matrix-client
extra_args: "--target /opt/ansible-modules"
If i try a test message with the matrix module i get this error:
3:14:27 PM
TASK [Send matrix notification with token] *************************************
3:14:27 PM
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'matrix_client'
3:14:27 PM
fatal: [con-4.c-lab.one]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (matrix-client) on con-4's Python /usr/bin/python3. Please read the module documentation and install it 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"}
3:14:27 PM
3:14:27 PM
PLAY RECAP *********************************************************************
3:14:27 PM
: ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
3:14:27 PM
3:14:27 PM
Running playbook failed: exit status 2
Container log
Installing additional python packages
Requirement already satisfied: virtualenv in ./.local/lib/python3.11/site-packages (from -r /etc/semaphore/requirements.txt (line 1)) (20.26.1)
Collecting matrix-client (from -r /etc/semaphore/requirements.txt (line 2))
Downloading matrix_client-0.4.0-py2.py3-none-any.whl (43 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.5/43.5 kB 583.0 kB/s eta 0:00:00
Requirement already satisfied: distlib<1,>=0.3.7 in ./.local/lib/python3.11/site-packages (from virtualenv->-r /etc/semaphore/requirements.txt (line 1)) (0.3.8)
Requirement already satisfied: filelock<4,>=3.12.2 in ./.local/lib/python3.11/site-packages (from virtualenv->-r /etc/semaphore/requirements.txt (line 1)) (3.14.0)
Requirement already satisfied: platformdirs<5,>=3.9.1 in ./.local/lib/python3.11/site-packages (from virtualenv->-r /etc/semaphore/requirements.txt (line 1)) (4.2.1)
Collecting requests~=2.22 (from matrix-client->-r /etc/semaphore/requirements.txt (line 2))
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 5.8 MB/s eta 0:00:00
Collecting urllib3~=1.21 (from matrix-client->-r /etc/semaphore/requirements.txt (line 2))
Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 7.6 MB/s eta 0:00:00
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/lib/python3.11/site-packages (from requests~=2.22->matrix-client->-r /etc/semaphore/requirements.txt (line 2)) (3.1.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3.11/site-packages (from requests~=2.22->matrix-client->-r /etc/semaphore/requirements.txt (line 2)) (3.4)
Collecting certifi>=2017.4.17 (from requests~=2.22->matrix-client->-r /etc/semaphore/requirements.txt (line 2))
Downloading certifi-2024.2.2-py3-none-any.whl (163 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.8/163.8 kB 7.7 MB/s eta 0:00:00
Installing collected packages: urllib3, certifi, requests, matrix-client
Successfully installed certifi-2024.2.2 matrix-client-0.4.0 requests-2.31.0 urllib3-1.26.18
Loading config
Thanks ins Advance