If you have installed Ansible and are using ZSH and when you run ansible –version you get command not found Ansible – this was my fix
When you install ZSH some path variables are changed and in your home directory a file called .zshrc is created.
You need to make sure that the directory that Ansible is installed is in your PATH
I am running Ubuntu 22 and Ansible latest version 2.13.4
I uninstalled Ansible first
pip3 uninstall Ansible
Then I re-installed Ansible
python3 -m pip install --user ansible
Then I edit the .zshrc file in my home directory and add the code below, you might have something there already.
export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin:$HOME/.local/bin:$PATH
The part that was missing for me was /usr/local/bin the separate parts are separated by :
Then I restart my terminal and voila!
➜ ~ ansible --version
ansible [core 2.13.4]
config file = None
configured module search path = ['/home/roger/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/roger/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/roger/.ansible/collections:/usr/share/ansible/collections
executable location = /home/roger/.local/bin/ansible
python version = 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0]
jinja version = 3.1.2
libyaml = True
Leave a Reply