Hello,
I use a separate pipenv for executing ansible:
pipenv run ansible-playbook -v tests/test_pip.yml
Now I have a playbook, that requires proxmoxer installed in the local pipenv:
name: test pipenv handling
hosts: localhost
tasks:
- name: install proxmoxer
delegate_to: localhost
ansible.builtin.pip:
executable: pipenv
name: proxmoxer
The task executes successfully, but I cannot find the proxmoxer package in the local Pipefile? The proxmoxer package is missing in the local site-packages directories as well.
Any hint how to ensure, that a pyrthon package is installed in the local execution environment?
Thanks a lot!
russoz
(russoz)
January 10, 2025, 8:39pm
2
Hi there
pipenv install proxmoxer
Executed from within your working directory, that should do the trick.
exactly, but I would like to have it inside the playbook
russoz
(russoz)
January 10, 2025, 8:43pm
4
Oops, jumped the gun.Not sure, try to run with -vvvv
, else take a look at the codw for pip
.
russoz
(russoz)
January 11, 2025, 11:16am
5
hi @DengelFred
I was puzzled by this so I thought of playing a bit. I got it to work by forcefully passing the directory:
Say your directory where you have the venv is /home/project/bubbles
. Then you do:
- name: test pipenv handling
hosts: localhost
tasks:
- name: install proxmoxer
delegate_to: localhost
ansible.builtin.pip:
executable: pipenv
name: proxmoxer
chdir: /home/project/bubbles
- ansible.builtin.command: pip list
Run ansible-playbook main.yml -vvvv
, it works fine.
2 Likes