Installing ansible

January 7, 2022 - Reading time: ~1 minute

With package manager in debian-like OS.

apt install python3
apt install python3-pip
apt install python3-argcomplete

Once python is installed, get ansible with:

python -m pip install ansible

Enable auto-complete:

mkdir ~/.ansible-auto
activate-global-python-argcomplete3 --dest ~/.ansible-auto
source ~/.ansible-auto/
# Remember to include this in your runtimeconfig

Generate config file with al options disabled:

ansible-config init -t all --disabled > ~/.ansible.cfg

Test installation by running ping module locally:

root@d29cb20e2399:~# ansible localhost -m ping
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"