Approaches for managing environments
You have already learned about the need to create different environments with identical roles, but with different data. At the time of writing this, more than one approach exists for managing such multiple environment scenarios with Ansible. We are going to discuss two approaches here, and you can use your best judgment to pick either of the two or create your own approach. There is no explicit way to create an environment, but the following are the built-in features of Ansible, which could come in handy:
The use of an inventory to group together hosts that belong to one environment and isolate them from the hosts in other environments
The use of inventory variables, such as the
group_vars
andhost_vars
groups, to provide environment-specific variables
Before we proceed, it would be useful to review the inventory groups, variables, and precedence rules that are applicable to them.
The inventory groups and variables
You have already learned learned that the...