Last Updated: February 25, 2016
· Lorin Hochstein

Defining global variables

Ansible allows you to define variables on a per-host and per-group basis.

Because ansible has the special all group that all hosts are automatically a part of, you can create an <INVENTORY_FILE_LOCATION>/group_vars/all file and populate it with variables. These variables will be accessible in all of your plays.

This saves you the trouble of explicitly defining a vars_files entry to include the global variable file in all of your plays.

2 Responses
Add your response

Thanks man. That was the right hint for me.

By the way. The link in the first line doesn't work anymore.

over 1 year ago ·

Thanks, @reiz, link has been fixed.

over 1 year ago ·