Designing a Scalable Python Ops Automation Platform with OMServer
This article explores building a scalable Python-based operations automation platform, detailing the OMServer architecture, why Python is chosen, module customization, security auditing, and client‑server implementation, while highlighting key third‑party libraries and future enhancements for DevOps teams.
Introduction
Today we discuss how to build an extensible Python-based operations automation platform, introducing OMServer and OManager, their functions, architecture, module customization, security auditing, and C/S implementation.
Why Choose Python?
Pre‑installed and cross‑platform
Readable and high development efficiency
Rich third‑party libraries
Active community
Platform Overview
OMServer is a centralized Linux cluster management platform offering business cluster management, real‑time security auditing, modular customization, encrypted data transmission, and support for mainstream Python components.
Source code: https://github.com/yorkoliu/pyauto
Key third‑party libraries
Django – MVC web framework
rpyc – RPC and distributed computing
saltstack, ansible, func – automation and configuration management
MySQL – relational database
Architecture Design
Three‑layer architecture
Web interaction layer (B/S, built with Django), distributed computing layer (rpyc), and cluster management service layer (integrating Saltstack/Ansible/Func).
Protocol flow: Front‑end parameters → encrypted transmission → task execution → result set → decryption.
Advantages
Multi‑machine management across IDC zones
High security with encrypted transmission and private TCP protocol
Supports WEB, desktop, and mobile clients
Leverages advanced Python component features (Playbook, State)
Strong extensibility and modular customization
Module Customization
Task modules represent atomic operations such as reloading configuration, deploying cache, or stopping Nginx. Developers define input parameters via HTML forms, write backend code using Saltstack or Ansible APIs, and can implement a simple shell task with only a few lines of code.
Execution flow: select task module & target → specify parameters → run → receive result.
Security Auditing
The auditing module consists of a front‑end display and an agent deployed on servers. The agent captures command history by modifying /etc/profile, sends events via HTTP GET to a database, and the front‑end refreshes periodically to show recent events.
C/S Structure Implementation
OManager provides a desktop client that communicates with the OMServer back‑end, following the same three‑layer design.
Future Optimizations
Integrate advanced Ansible or Saltstack features (e.g., playbooks)
Package multiple task modules into templates for workflow orchestration
Adopt Celery for higher concurrency
Add pause, abort, and retry controls for task queues
Connect with CMDB for broader applicability
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
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.