This article is kicking off a multipart series where we’re diving into the concept of generators and services, exploring their significance, structure, and how they can streamline processes for teams. Whether you’re a developer or just curious about automation in IT, this guide will provide you with a comprehensive understanding of generators and their applications.
What is a Generator?
A generator, in the context of Infrahub, is defined as a generic plugin that queries data and creates new nodes and relationships based on the results. This definition encompasses several key components that work together seamlessly to facilitate the automation of repeatable tasks. Link to the Generator topic in our docs
To visualize a generator, think of it as a combination of various elements: targeting the intended group of objects, the logic that powers it, and the GraphQL query that bridges everything. This combination of components allows teams to automate the generation of service deliverable objects efficiently and effectively.
Why Use Generators?
Generators are particularly beneficial for teams that have repeatable tasks that require consistency and efficiency. These tasks can range from deploying new VLANs to creating infrastructures for new locations, such as remote offices of a healthcare organization or new construction of franchise buildings.Â
In scenarios where organizations are scaling operations—like a hyperscaler creating new data centers or a managed service provider deploying numerous applications—generators offer a solution to streamline these processes. By inputting new variables, teams can generate a fresh version of the task each time, saving time and reducing errors.
While these scenarios are hardly an inclusive list, they do serve as a point to kickstart the thought process. To ask the question “What services does my team deliver?”
Example Generators in Action
While this is best illustrated in the videos, we can briefly discuss the two provided examples.
Data Center Fabric Example
In our first example, we created a branch called generator demo to work on establishing a new data center fabric. The process began with adding fabric for a new location, in this case, Chicago. We set up the spines and leaf groups, specifying the number of Layer Two and Layer Three leafs required.
Setting up the fabric parameters
Â
Â
Â
Next, we designated our target group within Infrahub, ensuring that our generator was aligned with the right site. After initiating the generator, we observed the tasks in progress, with successful outputs confirming the creation of our leaves and spines as per the defined parameters.
The generated objects
New Site Example
In our second example, we focused on creating a new site, specifically for Grand Rapids. This time, we selected a design type and specified the hardware—a Cisco 24 Port switch. The site was categorized under the automated sites group to ensure proper management and organization.
Setting up the new site parametersÂ
Similar to the previous generator, once started the logic was processed which led to the successful creation of the new design, with the requested equipment. As we refreshed the data, we noted the interfaces, IP address consumption, and configurations that were automatically generated, showcasing the efficiency of the generator in preparing for a new site to come online.
The generated objects
Artifacts and Their Importance
As we explored the generators, we also encountered the concept of artifacts. Artifacts are essential as they represent the actual configurations needed for devices, such as boot-up configurations. They play a critical role in implementing changes in existing environments or introducing new services.
By utilizing artifacts, teams can ensure that the generated infrastructure aligns with operational requirements, making the automation process not only efficient but also reliable.
Looking Ahead: Building Our Own Generator
Generators are a powerful tool in the Infrahub ecosystem, enabling teams to automate repetitive tasks effectively. By understanding their components, applications, and the importance of artifacts, you can leverage generators to enhance productivity and streamline operations.Â
In the upcoming segments of this series, we will take a step further by creating our own generator. This endeavor will involve a design phase where we outline the generator’s functionality before diving into the coding aspect. Our goal is to simplify the process while ensuring clarity and understanding.
Stay tuned as we embark on this journey to craft a generator tailored to specific needs, enhancing our capabilities through Infrahub.
Â
To learn more about Generators today, check out the following links to our documentation: