During the past few months, Red Hat has collaborated with Rockwell Automation to bring the Red Hat Ansible Automation Platform into a new realm: The control of embedded devices via the Common Industrial Protocol (CIP). This article introduces the value and uses of Ansible Automation Platform's CIP collection, now available in Ansible's Galaxy repository. The development site for this collection is on GitHub.
Lacking CIP, control over industrial devices has generally been performed by connecting the firmware and programs for a programmable logic controller (PLC) from a laptop over a USB cable. The procedure requires human intervention and isn't particularly scalable.
Our collaboration with Rockwell Automation established the viability of an Ansible Automation Platform project in this space and brought its power to a whole new class of devices.
Using configuration files to control devices
At Ansiblefest 2022, we showcased a demo case from Rockwell Automation, using the Ansible Automation Platform to tell the PLC to toggle an LED light and control the speed and direction of a motor via a variable frequency drive. Figure 1 shows how the computing components connect inside the demo case, containing the LED and a round motor.
Figure 2 shows the execution flow of the architecture. Ansible Automation Platform is the automation controller.
The behavior of the motor and LED is automated by adjusting tags (variables) within the PLC program using the new CIP collection. Traditional YAML and natural-language playbooks can make changes against devices. For example, the following code block instructs the PLC to start spinning the motor forward at 1Hz:
- name: Start motor slowly community.cip.ensure_tags: tags: - name: "Start" # Set ‘Start' to true value: True - name: "Stop" # Set ‘Stop' to false value: False - name: "MotorSetPoint" # Set the frequency of the motor value: 100 - name: "isForward" # Set the direction value: True
Figure 3 shows the illuminated LED, and the motor has rotated a bit.
After the task runs, the frequency shows on the drive.
Another task can adjust this tag again as follows:
- name: Speed up community.cip.ensure_tags: tags: - name: "MotorSetPoint" value: 5000
The new tag sets the drive to 50Hz, and the motor spins far more rapidly (Figure 4).
Real-world use cases for CIP collection
While adjusting the motor's revolutions per minute (RPMs) and toggling an LED might be a toy application, the CIP collection can manage industrial devices in production environments.
In the future, PLCs (and ultimately, the industrial systems they control) will become far more composable. Industrial device management can exploit some of the best practices from the DevOps world, such as infrastructure as code and GitOps, to enable agility at a scale not achievable today. New firmware versions that address vulnerabilities can be rolled out globally in a matter of minutes without requiring human intervention at every industrial site. Rapid prototyping can enable the development and testing of PLC programs to add features and functionality, which are immediately deployed to existing manufacturing lines. Also, manufacturing lines can be rapidly reconfigured and redeployed to manufacture new products without taking the line down for an extended period to reconfigure the control systems manually.
The CIP collection development team
Developing the CIP collection was a major team effort. We welcome your feedback. Comment below if you have questions, or you can get involved by visiting the GitHub repo issues page. We offer special thanks to the following collection authors from Rockwell Automation and Red Hat:
- Aaron Neustedter, Rockwell Automation
- Adam Miller, Red Hat
- Chris Santiago, Red Hat
- Matthew Sandoval, Red Hat
- Josh Swanson, Red Hat
- Chad Ferman, Red Hat