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.
There are several ways of adding information about your environment to your inventory.
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 [mail:vars] dns_servers=[ '8.8.8.8', '8.8.4.4' ] mail_port=25 EOF ~]#