Ansible is an open-source automation framework that automates apps and IT infrastructure. It does not use agents or additional security infrastructure that makes it easier to deploy.
Moreover, it uses YAML, which is a straightforward human-readable language, to describe the automation jobs. Most Ansible files are in YAML format. Ansible’s framework tools are made up of inventory, variables, playbooks, templates, plug-ins, and modules. The inventory consists of a Static hosts.ini file, and the variables consist of the following:
The group_vars in Ansible are a convenient way to apply variables to multiple hosts at once. Group_vars is an Ansible-specific folder as part of the repository structure. This folder contains YAML files created to have data models, and these data models apply to all the devices listed in the hosts.ini file. We can apply group variables to logical functions and hardware platforms. The variables should include a common identifier as the naming convention, such as
group_. A few examples of group_vars candidates include Netflow, Domain name, Multicast, Access control lists, Banners, and QoS policies.
The host_vars is a similar folder to group_vars in the repository structure. It contains data models that apply to individual hosts/devices in the hosts.ini file. Hence, there is a YAML file created per device containing specific information about that device.
The variables should be prepended with
hosts_for the naming convention, as well as to ensure better readability.
A few examples of host_vars variables include hostname, DHCP servers, VLANs, and physical interfaces.
View all Courses