Script can`t check the right version of ansible?

Hello guys, Im trying to do some stuff from engineer regarding linux and I have a request to install using pip3 ansible version 4.10.0 which I do, but for some reason the script doesnt recognize it.
The command that I use is pip3 install ansible==4.10.0, pip list shows the correct version :expressionless: also the binary it`s available for everyone.

Hi @rbscthdr

Can you please provide use the curriculum and level on the task so we can check on it

Regard

Hello, for sure. If it`s my lack of knowledge, please let me know.

Hi @rbscthdr

It’s mentioned on the ticket that he should be available for all user.

Make sure Ansible binary is available globally on this system, i.e all users on this system are able to run Ansible commands.

Im aware of that. For example if we create a new user and using lets say ansible --version, it is working. No issues like ansible command not found or anything regarding this.

If you don`t mind, may you give me a hint ?

Even if I use thor@jump_host ~$ sudo cp .local/bin/ansible /usr/local/bin

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for thor:
thor@jump_host ~$ ls -la /usr/local/bin/
total 32
drwxr-xr-x 1 root root 4096 Aug 21 11:53 .
drwxr-xr-x 1 root root 4096 Feb 7 2023 …
-rwxr-xr-x 1 root root 6439 Aug 21 11:53 ansible
-rwxr-xr-x 1 root root 219 Aug 4 08:16 asciinema
-rwxr-xr-x 1 root root 227 Aug 4 08:16 pip
-rwxr-xr-x 1 root root 227 Aug 4 08:16 pip3
-rwxr-xr-x 1 root root 227 Aug 4 08:16 pip3.6
thor@jump_host ~$

It still doesn`t work…

Hi @rbscthdr
Try to install it with root user


I`ve tried to install it with root, the ansible command was not found :slight_smile:

Thank you but using root to install it aint the solution, since its not really working. If you try to do that you will get some warnings from ansible I suppose with finally not working unless youre using some sort of python virtual environment. If you dont mind, can show me what commands did you use to finish this lab ?

Youre right, but the ansible command doesnt work for root :slight_smile: .

Roger that. Thank you for your help and time ! Really useful !

1st command : sudo pip3 install ansible==
2nd command : ansible --version(if it shows version then it is installed for that user)
3rd command : which ansible(this will display the path where ansible is stored, copy the path)
4th command : sudo vi /etc/profile.d/ansible.ssh(press i to go into insert mode)
5th command : export PATH=“:$PATH”(press esc to revert back back from insert mode and write :wq to save the file)
6th command : sudo chmod a+rx /etc/profile.d/ansible.sh
7th command : sudo -i (to become root user)
8th command : ansible --version(if it shows version then congratulations…)