Installation

Installation on Fedora may require separately installing Python2 (because Python 3 is the default):

$ sudo dnf install ansible python2 libselinux-python

Terminology

  • Modules are reusable, standalone scripts that can be run using ansible or from an ansible-playbook command

Group vars

  • Use group_vars/mygroup to define a variables file which will be used by playbooks in the group named mygroup.
  • If a host is defined in multiple groups, it will receive the variables from each group_vars/groupname file.

Cookbook

Running arbitrary commands

Run DNF update cache on a host as root on nodes in the hosts file:

ansible all -m dnf -a 'update_cache=true' -i ./hosts -u root --become