Automate Huawei CloudEngine Switches with Ansible: A Step‑by‑Step Guide
This article explains how to use Ansible to automate Huawei CloudEngine data‑center switches, covering integration methods, module overviews, practical use cases, preparation steps, playbook creation, and execution details for efficient network operations.
1. Introduction
With the rise of cloud computing, big data and mobile internet, data‑center traffic is growing rapidly, demanding fast‑response network solutions. Huawei CloudFabric provides a next‑generation data‑center network based on flagship CloudEngine switches and the iMaster NCE management platform.
CloudFabric’s open ecosystem removes inter‑vendor barriers and supports third‑party management tools. Ansible, which requires no agents on devices, is widely adopted for unified IT and network resource management. Huawei released open‑source Ansible‑CloudEngine modules to enable secure, efficient, and reliable network automation.
2. Ansible Integration with CloudEngine Switches
2.1 Integration Methods
Huawei offers feature modules that can be invoked via playbooks, encapsulating CLI or NETCONF commands (e.g., six VXLAN gateway CLI commands become a single API module). Over 70 modules cover full‑scene configuration, underlay/overlay deployment, daily operations, and automation.
2.2 Module Overview
The modules are grouped as follows:
Basic features : Command, Configure, AAA, NTP, SNMP, Syslog, Rollback, Reboot, CopyFile
L2 & L3 features : Interface (L2/L3), DLDP, VLAN, ETH‑TRUNK, STP, Static Route, OSPF, BSP, M‑LAG
ACL & Overlay : ACL, VXLAN, EVPN, BGP, VRF, ENVP, Netstream, NTP, VRRP
Status queries : Device, interface status, counters, logs, version, CPU, health, license, serial number
2.3 Use Cases
2.3.1 Overlay and Underlay Configuration
Steps:
Install and start Ansible on a server.
Generate configuration files from typical templates.
Invoke the Ansible API to push configurations to switches.
2.3.2 Operations
Set playbook variables to monitor MAC table size, transceiver power, etc.
Use the Ansible API to query switches.
Playbooks collect information, detect anomalies and trigger email alerts.
3. Using Ansible to Configure CloudEngine Switches
3.1 Prepare the Switch
Ansible connects via SSH. Configure the switch as follows: # Create SSH user root0001 Enable STelnet and SNetconf services, set the SSH user service mode to all, and ensure SSH access.
3.2 Prepare the Deployment Environment
Install Ansible on the control host (e.g., Ubuntu) and verify SSH connectivity to the switches. Update /etc/ansible/hosts so the switches are reachable.
3.3 Create a Playbook
A sample playbook to retrieve device version information includes fields such as name, hosts, gather_facts, connection, tasks, and uses the ce_command module.
3.4 Execute the Playbook
Run the playbook with ansible-playbook ce_command.yml. The output shows PLAY, TASK, PLAY RECAP, and DEBUG sections indicating successful execution and collected device information.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Huawei Cloud Developer Alliance
The Huawei Cloud Developer Alliance creates a tech sharing platform for developers and partners, gathering Huawei Cloud product knowledge, event updates, expert talks, and more. Together we continuously innovate to build the cloud foundation of an intelligent world.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
