BSD Support

    Typically, Ansible will try to default to using OpenSSH as a connection method. This is suitable when using SSH keys to authenticate, but when using SSH passwords, Ansible relies on sshpass. Mostversions of sshpass do not deal particularly well with BSD login prompts, so when using SSH passwords against BSD machines, it is recommended to change the transport method to paramiko. You can do this in ansible.cfg globally or you can set it as an inventory/group/host variable. For example:

    Ansible is agentless by default, however certain software is required on the target machines.

    Operating without Python is possible with the module. Although this module can be used to bootstrap Ansible and install Python on BSD variants (see below), it is very limited and the use of Python is required to make full use of Ansible’s features.

    Bootstrapping BSD

    As mentioned above, you can bootstrap Ansible with the raw module and remotely install Python on targets. The following example installs Python 2.7 which includes the json library required for full functionality of Ansible.On your control machine you can execute the following for most versions of FreeBSD:

    Once this is done you can now use other Ansible modules apart from the raw module.

    Note

    This example demonstrated using pkg on FreeBSD and pkg_add on OpenBSD, however you should be able to substitute the appropriate package tool for your BSD; the package name may also differ. Refer to the package list or documentation of the BSD variant you are using for the exact Python package name you intend to install.

    To support a variety of Unix/Linux operating systems and distributions, Ansible cannot always rely on the existing environment or variables to locate the correct Python binary. By default, modules point at /usr/bin/python as this is the most common location. On BSD variants, this path may differ, so it is advised to inform Ansible of the binary’s location, through the ansible_python_interpreter inventory variable. For example:

    Which modules are available?

    The majority of the core Ansible modules are written for a combination of Linux/Unix machines and other generic services, so most should function well on the BSDs with the obvious exception of those that are aimed at Linux-only technologies (such as LVG).

    Using BSD as the control machine is as simple as installing the Ansible package for your BSD variant or by following the or ‘from source’ instructions.

    BSD Facts

    Ansible gathers facts from the BSDs in a similar manner to Linux machines, but since the data, names and structures can vary for network, disks and other devices, one should expect the output to be slightly different yet still familiar to a BSD administrator.

    BSD support is important to us at Ansible. Even though the majority of our contributors use and target Linux we have an active BSD community and strive to be as BSD friendly as possible.Please feel free to report any issues or incompatibilities you discover with BSD; pull requests with an included fix are also welcome!