12-13-2022 12:29 AM - edited 12-13-2022 01:59 AM
Hi experts,
In order to manage an ACI Fabric, I'm currently setting up an environment with ansible inside a python venv on a linux Alma 8 platform.
Below, the steps I used to install the components :
# Venv creation
[MyUser@MyAnsibleVm ~]$python3 -m venv ansible4.10
[MyUser@MyAnsibleVm ~]$source ansible4.10/bin/activate
# pip installation / upgrade
(ansible4.10) [MyUser@MyAnsibleVm ~]$python3 -m ensurepip --default-pip
(ansible4.10) [MyUser@MyAnsibleVm ~]$python3 -m pip install --upgrade pip
# Ansible installation
(ansible4.10) [MyUser@MyAnsibleVm ~]$python3 -m pip install ansible
At the end we have ansible installed correctly. All the steps seems to be good.
# List packages
(ansible4.10) [MyUser@MyAnsibleVm ~]$ python3 -m pip list
Package Version
------------ -------
ansible 4.10.0
ansible-core 2.11.12
cffi 1.15.1
cryptography 38.0.3
Jinja2 3.0.3
...
Unfortunately, if I check the ansible version inside my venv, I still have my old global ansible version, rather than the new venv version :
(ansible4.10) [MyUser@MyAnsibleVm ~]$ ansible --version
ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/MyUser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, May 24 2021, 08:40:28) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
Any ideas to help ?
Thank you
Ju
Solved! Go to Solution.
12-16-2022 08:03 AM
Hi Alex,
Thank you for your time.
Finally, the problem was related to security restrictions on the partition where my venv was located.
It works perfectly on another mounting point.
Regards
Ju
12-15-2022 06:50 AM
Hi @ju.mahieu,
This reminds me of an issue I was having with pyenv recently. So frustrating. Patience and knowing when to start over are key!
Please try these steps:
1. updrade pip inside your venv
python3 -m pip install --upgrade pip
2. specify which version exactly of Ansible to install
python3 -m pip install ansible==4.1.0
3. see where Ansible is installed
which ansible
~/python-venv/ansible4.1.0/bin/ansible
4. check Ansible version
ansible --version
You should see a response back containing something like this:
ansible python module location = /home/devops/python-venv/ansible4.1.0/lib64/python3.6/site-packages/ansible executable location = /home/devops/python-venv/ansible4.1.0/bin/ansible python version = 3.6.8
I hope this works or at least helps!
12-16-2022 08:03 AM
Hi Alex,
Thank you for your time.
Finally, the problem was related to security restrictions on the partition where my venv was located.
It works perfectly on another mounting point.
Regards
Ju
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: