Configuring the Ansible inventory
The Ansible inventory is the heart of the product as it provides a lot of variables about your environment to the deployment mechanism. These variables are known as facts
and serve Ansible to make decisions, template text-based files, and so on.
How to do it…
There are several ways of adding information about your environment to your inventory.
The static inventory file
The static inventory is basically a mini-formatted file containing the definitions for hosts and groups. Here's what you need to do:
- Create
/etc/ansible/hosts
with the following contents:~]# cat << EOF >> /etc/ansible/hosts localhost ansible_connection=local srv1.domain.tld ansible_connection=ssh ansible_ssh_user=root [mail] mail[01..50].domain.tld ...
Get Red Hat Enterprise Linux Server Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.