Data Model Structure
Explore how to build and organize data models using group_vars and host_vars in Ansible for network automation. Understand naming conventions and classification of variables to maintain consistent and scalable device configurations.
We'll cover the following...
Like the investment and thought that went into the hosts
structure, a lot of up-front time and planning is required to build data
model structures. Some basic formatting standards, variable naming
conventions, and a variable dictionary hierarchy should be established
and followed rigidly.
group_vars
As part of the repository structure, there is a folder called
group_vars. This is an Ansible-specific folder used to set up data
models for the groups configured in the hosts file. Group
variables are applied to all common hardware platforms or logical
functions. If, for example, a common QoS policy is configured on all the
distribution switches, abstract the QoS policy data into a model in the
CAMPUS-DISTRIBUTION.yml group_vars file.
[CAMPUS-DISTRIBUTION] can be called a group_vars by
creating a YAML file called CAMPUS-DISTRIBUTION.YML ...