# Ansible Resources

## Variables

Variables can be stored in many different locations.  Keep this reference under your pillow.

## Roles

While roles are the unit of Ansible software re-use, the official Ansible documentation on roles can be difficult to find.

## Configuration

Ansible can be configured using a configuration file or environment variables.  Consult the ansible configuration documentation for information about where ansible looks for configuration files and how they should be formatted.

### Common Configuration Questions



#### Cowsay

If you have Cowsay installed, the Ansible devs assume you want to use it by default.  You can disable it with:

nocows = 0


#### Retry Files

When a playbook fails, Ansible creates a .retry file with a list of the hosts it failed on.  In most situations these are not useful and end up being clutter, they can be disabled with

retry_files_enabled = False


#### Output Formatting

The default output of Ansible is designed to be compact, but there are many callback plugins to change the formatting.  If you want something more readable, try:

stdout_callback = debug


#### Setup is taking too long with ChefDK installed

Why is the setup/fact gathering phase taking so long?  You probably have chefdk installed.  For whatever reason this seems to cause issues for some people.  You can disable ohai by updating your gathering configuration.

gather_subset  = !ohai


#### Ansible reports "Failed to connect to the host via ssh." but I can manually ssh in fine

Your version of Ansible is probably out of date. This should be fixed in the most recent version of Ansible. If not, adding the following your ansible.cfg file should fix it:

[ssh_connection]
control_path = %(directory)s/%h-%r