This post briefly explains how to install Ansible on a FreeBSD host.

I’m going to install Ansible in a virtual environment using Python 3. (If you still use Python 2, it’s time to start migrating to Python 3 now.)

$ sudo pkg install python36
$ mkdir ~/dev/python3-venv
$ python3 -m venv ~/dev/python3-venv/ansible

Next, activate the Python venv (ansible), and start installing Ansible using pip:

$ source ~/dev/python3-venv/ansible
$ pip install ansible

You may or may not need to update pip module as I did. In my case, Python complains that I have older version of pip. To update pip, just run:

$ pip install -U pip

That’s it. Ansible should have been installd. While the Python vevn is still activated, run:

$ ansible --version
ansible 2.7.7
  config file = None
  ....

Ref: