I have installed Ansible via pip3, but I can't find the Ansible commands (ansible --version, ansible-playbook, etc.)

Here's the listing that shows that Ansible is installed via pip3:

:~# pip3 list | grep ansible DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning. ansible (3.1.0) ansible-base (2.10.7) 

But I can find no file or what so ever in /usr/bin and the commands are not found:

:~/.ansible# ls -ltrha total 12K drwx------ 3 root root 4.0K Feb 3 11:42 . drwx------ 3 root root 4.0K Mar 19 16:01 tmp drwx------ 8 root root 4.0K Mar 22 15:34 .. 

Do I need to configure something? Is my installation done improperly?

I use Debian GNU/Linux 9 (stretch)

2

1 Answer

This situation tends to happen as @micke commented - while using pip3 as root user - the installed CLI tool may end up in a directory that's not included in $PATH environment variable - then you need to adjust $PATH.

Tested on Debian10 all performs as expected:

root@d10:~# pip3 install ansible Collecting ansible Downloading (36.8MB) 100% |████████████████████████████████| 36.8MB 35kB/s #pip3 install log truncated... root@d10:~# ansible --version [DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]. This feature will be removed from ansible-core in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. ansible [core 2.11.7] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0] jinja version = 3.0.3 libyaml = True root@d10:~# which ansible /usr/local/bin/ansible 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy