This project leverages OpenShift 4.17 and Red Hat Ansible Automation Platform 2.5 to automate workflows, streamline decision-making, and activate rulebooks. This document explains installation and use of Ansible Automation Platform with Automation Decisions, Automation Execution Below is a step-by-step guide to setting up the environment and utilizing the platform's features effectively.
- OpenShift 4.17 environment set up and configured.
- Ansible Automation Platform 2.5 operator installed and configured.
- Kubernetes NMState operator installed.
- OpenShift SR-IOV Network operator installed.
- Juniepr Apstra 5.0 or 5.1
- Access to Juniper public Git repository containing the automation project files.
Useful documentation:
- Automation Decisions
- Automation Execution Configuration
- Installing NMState Operator
- Installing SR-IOV Network Opeator
This project uses Automation Decisions and Automation Execusion for getting events and running ansible jobs respectively. This document describes how to configure both the tools for Juniper Apstra Event Driven Automation.
You can run Ansible automation in containers, like any other modern software application. Ansible uses container images known as Execution Environments (EE) that act as control nodes.
To create Execution Envrionments container image follow the instructions from here
Once container image is created and pushed to artifactory or similar location which is accessible by Ansible Automation Platform, follow below steps to create Execution Environment.
- Naviagte to Automation Controller.
- Go to Infrastructure.
- Click on Execution Environments.
- Click on Create Execution Environment.
- Mention the Name, Image(created in step above), Pull Option, Organization(remains same for all the components)
- Click on Create Execution Environment.
Check the sample configuration of tower here Once Execution Environment is created, mention the name of the Execution Environment while creating templates.
Credentials are essential for accessing external systems and running automation jobs. Follow these steps:
- Navigate to Automation Controller.
- Go to Credentials under the Resources section.
- Click Add to create a new credential.
- Fill in the following fields:
- Name: A descriptive name for the credential.
- Type: Select the appropriate credential type (e.g., Machine, GitHub Personal Access Token).
- Inputs: Provide the required inputs based on the credential type.
- Save the credential.
We need to create below credetials for automation jobs.
Selecting this credential type allows you to create instance groups that point to a Kubernetes or OpenShift container. Get more information how to create OpenShift API Bearer token type of credentials here
This will be used to get access to OpenShift cluster from automation jobs using service account.
We need to create credentials type for Apstra.
- Navigate to Creadentials Types.
- Create Credential Types.
- Name Credential Type as Juniper Apstra.
- Put below in Input configuration.
fields:
- id: api_url
type: string
label: API URL
help_text: The URL used to access the Apstra API
- id: verify_certificates
type: boolean
label: Verify Certificates
default: true
help_text: Whether to verify SSL certificates
- id: username
type: string
label: Username
help_text: The username for authentication
- id: password
type: string
label: Password
secret: true
help_text: The password for authentication
required:
- api_url
- username
- password
- Add below in Injector configuration.
env:
APSTRA_API_URL: '{{ api_url }}'
APSTRA_PASSWORD: '{{ password }}'
APSTRA_USERNAME: '{{ username }}'
APSTRA_VERIFY_CERTIFICATES: '{{ verify_certificates }}'
file: {}
extra_vars: {}
- Save the credentials type.
Next step is to create credential of type Juniper Apstra following the steps mentioned in Creating Credentials
In this case, inventory should have jobs running on controlplane nodes in instance group. We can select controlplane nodes in Demo Inventory.
A project is a logical collection of playbooks, inventories, and configurations.
- Navigate to Projects in the Automation Controller.
- Click Add to create a new project.
- Configure the following:
- Name: Enter a project name.
- Organization: Select an organization.
- Source Control Type: Choose Git.
- Source Control URL: Enter the URL of the public repository.
- Credentials: (Optional) Select credentials if the repository requires authentication.
- Save the project and allow the sync process to complete.
Templates define jobs and workflows for automation execution.
- Navigate to Templates in the Automation Controller.
- Click Add and choose Job Template.
- Provide the following information:
- Name: A descriptive name for the job template.
- Inventory: Select the inventory to run the job against.
- Project: Select the previously created project.
- Playbook: Choose a playbook from the selected project.
- Credentials: Assign the required credentials.
- Save the job template.
We need to templates for each type of action. Please refer the images for creating these templates.
- Create Security Zone
- Delete Security Zone
- Create Virtual Network
- Delete Virtual Network
- Create Connectivity Template
- Delete Connectivity Template
- Init-done
Automation Decisions help define and execute rule-based workflows.This is similar to creating execution environment mentioned in Creating Execution Environments
Please refer guide to create container image and deploy decision environment. Once container image is create follow the steps below to create decision environment.
- Navigate to Automation Decisions.
- Click Add Decision Environment to set up the environment:
- Configure inputs, such as decision tables, and link them to automation templates.
- Specify the rule sets and rulebooks to be activated.
- Deploy the decision environment.
This is sample decision environment creation image.
For detailed guidance, refer to the Using Automation Decisions Documentation.
This step is similar to Creating a Project from a Public Repository
Below are the types of credentials that we create in Automation Decesions.
- Red Hat Ansible Automation Platform
We need to get access to Ansible Execution to run jobs in Execution environment.
- Navigate to Users, select the user and go to tokens.
- Create token and save the token.
- Navigate to Automation Decisions.
- Go to Infrastructure and click on Credentials.
- Create credentials type Red Hat Ansible Automation Platform.
- Paste the token and Red Hat Ansible Automation Platform URL.
Example credential can be reffered here.
Rulebook activations are used to trigger specific rule-based workflows.
- Navigate to Rulebook Activations.
- Click Add to create a new activation.
- Fill in the following details:
- Name: Enter a name for the activation.
- Rulebook: Choose the rulebook to activate.
- Inventory: Select the inventory to use.
- Execution Environment: Select the execution environment.
- Variables: Provide any required input variables.
- Save and activate the rulebook.
Example of Rulebook Activation can be reffered here
You specify the SR-IOV network device configuration for a node by creating an SR-IOV network node policy. The API object for the policy is part of the sriovnetwork.openshift.io API group.
Find example files here
Please refer explanation of each field here
This section highlight what you can expect while creating various OpenShift Objects.
OpenShift Object | Apstra Object | Description |
---|---|---|
Project | Routing Zones(VRF) | Creating/Deleting Project will create Routing Zones(VRF) in Apstra. |
SriovNetwork | Virtual Networks(VNET) | Creating/Deleting SriovNetwork will create Virtual Networks(VNET) in Apstra. |
Pod | Connectivity Template | Creation of VNET creates connectivity template automatically in Apstra, Pod will be mapped to respective node and port in connectivity templates dynamically. |
- Validate the decision/execution workflows and rulebook activations through logs and dashboards in the Automation Controller and Automation Decision.
- Validate projects gets synced properly.
Once above validation is done, we can run sample yamls from folder and validate.
- First we create Routing Zones, for that we create project in OpenShift. Check file project.yaml
- You can verify automation job starts and the Routing Zone created in Apstra.
- Once project is created, we can create SRIOVNetwork. Check file sriov-vn1.yaml
- You can verify automation job starts and the Virtual Network created in Apstra.
- Once Virtual Network is created , you can see connectivity templates get created.
- Now, you can run SRIOV workloads(Pod/Deployment) on this Virtual Network. Refer file deployment-vn1.yaml
- You can verify automation job starts and node port is mapped in connectivity template.
This project is licensed under the MIT License. See LICENSE
for more details.
For questions or issues, please reach out to [Pratik Dave] at [[email protected]].