AWX高级工具
Ansible AWX/Tower的生产级人工智能自动化平台
    ](https://www.docker.com/)
概述
AWX Advanced Tools是一个企业级微服务平台,它使大型语言模型(LLM)能够通过自然语言命令管理Ansible AWX/Tower基础设施。它基于10台专用服务器的分布式架构构建,提供智能路由、全面的安全功能和生产级可靠性。
主要特点
- 多服务器架构:针对小型LLM上下文窗口优化的10个专用微服务
- 企业安全:模拟运行模式、确认工作流程、全面的审计日志记录
- 生产就绪:完整的CI/CD管道、健康检查、监控集成
- 灵活部署:Docker Compose用于开发,Kubernetes用于生产
- LLM优化:具有模型感知功能的智能工具发现
用例
- DevOps自动化:自然语言作业执行和基础设施管理
- 自助服务运营:使非技术团队能够管理AWX工作流
- 自动修复:人工智能驱动的事件响应和系统恢复
- 审计与合规:完成活动记录和变更跟踪
- 集成中心:将AWX与LLM驱动的聊天界面连接
______________________________________________________________________
目录
- - Kubernetes
______________________________________________________________________
建筑
多服务器设计
AWX Advanced Tools采用微服务架构,有10个专用服务器,每个服务器处理特定的AWX域:
┌─────────────────────────────────────────────────────────┐
│ AWX Advanced Tools v2.0 │
│ Multi-Server Microservices Architecture │
├──────────┬──────────┬──────────┬──────────┬────────────┤
│ Core │ Inventory│ Templates│ Users │ Projects │
│ :8001 │ :8002 │ :8003 │ :8004 │ :8005 │
│ 6 tools │ 8 tools │ 7 tools │ 7 tools │ 7 tools │
├──────────┼──────────┼──────────┼──────────┼────────────┤
│ Orgs │ Schedules│ Advanced │ Notify │ Infra │
│ :8006 │ :8007 │ :8008 │ :8009 │ :8010 │
│ 6 tools │ 7 tools │ 5 tools │ 2 tools │ 3 tools │
└──────────┴──────────┴──────────┴──────────┴────────────┘
│
┌─────▼─────┐
│ Redis │
│ Cache │
└───────────┘
│
┌─────▼─────┐
│ AWX │
│ Instance │
└───────────┘服务器职责
| 服务器 | 端口 | 用途 | 工具 |
|---|---|---|---|
| 核心 | 8001 | 健康检查、工作监控 | ping_awx(), get_job(), list_jobs(), cancel_job() |
| 库存 | 8002 | 库存和主机管理 | list_inventories(), create_inventory(), list_hosts(), create_host() |
| 模板 | 8003 | 作业模板操作 | list_templates(), launch_job_template(), create_job_template() |
| 用户 | 8004 | 用户和团队管理 | list_users(), create_user(), update_user(), delete_user() |
| 项目 | 8005 | SCM项目管理 | list_projects(), create_project(), sync_project() |
| 组织 | 8006 | 组织CRUD | list_organizations(), create_organization(), update_organization() |
| 日程表 | 8007 | 作业调度 | create_schedule(), toggle_schedule(), list_schedules() |
| 高级 | 8008 | 证书和高级操作 | list_credentials(), create_credential(), update_credential() |
| 通知 | 8009 | 活动监测 | list_activity_stream() |
| 基础设施 | 8010 | 系统信息 | get_awx_version(), list_instance_groups(), get_awx_config() |
设计原则
- 单一责任:每台服务器管理一个域
- 共享库:通用AWX客户端确保一致性
- 无状态:服务器可以水平扩展
- 健康监测:所有服务器都暴露
/health端点 - 审计跟踪:完整记录所有操作
技术栈
- 框架:FastAPI 0.115+(异步/等待)
- 语言:Python 3.10+
- 验证:Pydantic 2.8+
- HTTP客户端:httpx(异步)
- 缓存:Redis(可选)
- 容器:Docker+Docker组合
- 编排:库贝内特斯1.20+
______________________________________________________________________
先决条件
必需
- python:3.10或更高
- 码头工人:20.10或更高
- Docker Compose:2.0或更高
- AWX/塔:正在运行具有API访问权限的实例
- 网络:与AWX实例的连接
可选的
- Kubernetes:1.20+(用于生产部署)
- 瑞迪斯:用于分布式缓存
- 普罗米修斯:用于指标收集
- 格拉法纳:用于监控仪表板
系统要求
发展
- CPU:2核
- 内存:4GB
- 磁盘:10 GB可用空间
生产
- CPU:4+核
- 内存:8+GB
- 磁盘:20+GB SSD
- 网络:对AWX实例的低延迟
______________________________________________________________________
快速开始
1.克隆存储库
git clone https://github.com/antuelle78/awx_advanced_tools.git
cd awx_advanced_tools/mcp-server2.配置环境
cp .env.example .env编辑 .env 使用您的AWX证书:
AWX_BASE_URL=https://your-awx-instance.com
AWX_USERNAME=admin
AWX_PASSWORD=your_secure_password3.使用Docker Compose进行部署
选项A:单个单片服务器
docker compose up -d服务器位于: http://localhost:8001
选项B:多服务器体系结构(推荐)
docker compose -f docker-compose.multi.yml up -d服务器在端口8001-8010上可用。
4.验证部署
# Check all servers
for port in {8001..8010}; do
echo -n "Port $port: "
curl -s http://localhost:$port/health | jq -r '.status'
done预期产量: healthy 对于所有服务器。
5.测试API
# List inventories
curl http://localhost:8002/inventories
# List job templates
curl http://localhost:8003/templates
# Check AWX connectivity
curl http://localhost:8001/ping______________________________________________________________________
部署
Docker编写部署
开发环境设置
# Build and start all services
docker compose -f docker-compose.multi.yml up -d --build
# View logs
docker compose -f docker-compose.multi.yml logs -f
# Stop services
docker compose -f docker-compose.multi.yml down配置
这 docker-compose.multi.yml 包括:
- 10台专用MCP服务器
- Redis缓存
- 所有服务的健康检查
- 持久审计日志
- 网络隔离
扩展个人服务
# Scale inventory server to 3 replicas
docker compose -f docker-compose.multi.yml up -d --scale inventory=3
# Scale templates server to 2 replicas
docker compose -f docker-compose.multi.yml up -d --scale templates=2Kubernetes部署
先决条件
- kubectl配置了集群访问权限
- Kubernetes 1.20或更高版本
- LoadBalancer或Ingress控制器(用于外部访问)
快速部署
# Apply ConfigMap (update with your AWX credentials first)
kubectl apply -f k8s/configmap.yaml
# Deploy all 10 servers
kubectl apply -f k8s/multi-server-deployment.yaml
# Verify deployment
kubectl get pods -l tier=mcp-server
kubectl get services | grep mcp-生产配置
- 更新配置 持有生产证书:
# k8s/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: awx-advanced-tools-config
data:
AWX_BASE_URL: "https://awx.production.com"
AWX_USERNAME: "automation-user"
# Use Secrets for sensitive data in production- 创建Kubernetes密钥 对于凭据:
kubectl create secret generic awx-credentials \
--from-literal=username=admin \
--from-literal=password=your_secure_password- 配置资源限制:
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"- 设置Ingress 对于外部访问:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mcp-ingress
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
tls:
- hosts:
- awx-tools.example.com
secretName: awx-tools-tls
rules:
- host: awx-tools.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mcp-core
port:
number: 8001- 启用水平Pod自动缩放:
kubectl autoscale deployment mcp-inventory --cpu-percent=70 --min=2 --max=10
kubectl autoscale deployment mcp-templates --cpu-percent=70 --min=2 --max=10监控Kubernetes部署
# Check pod status
kubectl get pods -l tier=mcp-server -w
# View logs from specific server
kubectl logs -l app=mcp-core -f --tail=100
# Describe pod for troubleshooting
kubectl describe pod
# Check service endpoints
kubectl get endpoints______________________________________________________________________
配置
环境变量
所有服务器都接受以下环境变量:
必需
| 变量 | 描述 | 示例 |
|---|---|---|
AWX_BASE_URL | AWX/塔API基础URL | https://awx.example.com |
AWX_USERNAME | AWX用户名(如果不使用令牌) | admin |
AWX_PASSWORD | AWX密码(如果不使用令牌) | secure_password |
AWX_TOKEN | AWX API令牌(替代用户/通行证) | AbCdEf123456... |
可选的
| 变量 | 描述 | 默认值 |
|---|---|---|
AUDIT_LOG_DIR | 审计日志目录 | /var/log/mcp |
REDIS_HOST | Redis服务器主机名 | redis |
REDIS_PORT | Redis服务器端口 | 6379 |
REDIS_DB | Redis数据库编号 | 0 |
LLM_PROVIDER | LLM提供者(default 或 ollama) | default |
LLM_ENDPOINT | LLM API端点 | http://localhost:11434 |
LLM_MODEL | LLM型号名称 | gpt-4o |
LLM_API_KEY | LLM API密钥 | - |
JWT_SECRET | JWT身份验证的秘密 | 随机 |
配置文件
创建 .env 文件:
# AWX Configuration
AWX_BASE_URL=https://awx.production.com
AWX_TOKEN=your_awx_api_token
# Or use username/password
AWX_USERNAME=automation-user
AWX_PASSWORD=secure_password
# Logging
AUDIT_LOG_DIR=/var/log/awx-tools
# LLM Integration (Optional)
LLM_PROVIDER=ollama
LLM_ENDPOINT=http://ollama:11434
LLM_MODEL=granite3.1-dense:8b
# Cache (Optional)
REDIS_HOST=redis
REDIS_PORT=6379
# Security
JWT_SECRET=change_this_to_random_stringAWX用户权限
AWX用户/令牌必须具有适当的权限:
最低权限:
- 阅读:所有资源
- 执行:作业模板
- 创建/更新/删除:基于用例
推荐设置:
- 创建专用AWX用户:
# In AWX UI: Users > Add User
Username: awx-tools-automation
Organization: Default
User Type: System Administrator- 生成API令牌:
# In AWX UI: Users > awx-tools-automation > Tokens > Add Token
Scope: Write- 在配置中使用令牌:
AWX_TOKEN=______________________________________________________________________
API 参考
响应格式
所有API端点返回的响应格式为 降价表 以获得最佳的LLM消耗。这提供了结构化、可读的输出,与人工智能助手和聊天界面配合良好。
表响应格式
清单的操作 以表格格式返回分页结果:
| ID | Name | Description | Created | Modified |
|----|------|-------------|---------|----------|
| 7 | Demo Job Template | N/A | 2025-09-13 15:39 | 2025-10-25 15:22 |
| 8 | Backup Template | Automated backup | 2025-10-01 09:15 | 2025-10-25 16:45 |单项操作 返回详细的键值表:
| Property | Value |
|----------|-------|
| Id | 7 |
| Name | Demo Job Template |
| Description | N/A |
| Created | 2025-09-13 15:39 |
| Modified | 2025-10-25 15:22 |操作结果 显示成功/失败状态:
| Operation | Status | Details |
|-----------|--------|---------|
| Launch Job Template | Success | Job ID: 157 started |LLM的好处
- 结构化数据:一致的列布局便于解析
- 截断内容:长文本会自动用“…”截断
- 格式化日期:ISO时间戳转换为可读格式
- 布尔值:正确/错误显示为“是”/“否”
- 分页信息:显示截断结果时的总计数
健康检查端点
所有服务器都公开标准健康端点:
GET/健康
返回服务器运行状况。
答复:
{
"status": "healthy",
"timestamp": "2025-11-01T22:00:00Z",
"server": "core",
"version": "2.0.0"
}获取/准备就绪
返回准备状态(包括AWX连接检查)。
答复:
{
"ready": true,
"awx_connected": true,
"services": {
"awx": "ok",
"redis": "ok"
}
}核心服务器(端口8001)
GET/ping
测试AWX连接。
答复:
{
"message": "pong",
"awx_version": "23.3.0",
"connected": true
}GET/职位
列出所有分页作业。
参数:
page(int):页码(默认值:1)page_size(int):每页项目数(默认值:20)
答复:
| ID | Name | Status | Started | Finished |
|----|------|--------|---------|----------|
| 42 | Deploy Application | successful | 2025-11-01 20:00 | 2025-11-01 20:05 |
| 43 | Database Backup | successful | 2025-11-01 19:30 | 2025-11-01 19:45 |GET/jobs/{job_id}
获取具体的工作细节。
答复:
| Property | Value |
|----------|-------|
| Id | 42 |
| Name | Deploy Application |
| Status | successful |
| Job Template | 10 |
| Started | 2025-11-01 20:00 |
| Finished | 2025-11-01 20:05 |
| Elapsed | 300 |库存服务器(端口8002)
GET/库存
列出库存。
参数:
name(str):按名称筛选organization(int):按组织ID筛选
答复:
| ID | Name | Organization | Hosts Count | Groups Count |
|----|------|--------------|-------------|--------------|
| 1 | Production | Default | 50 | 5 |
| 2 | Staging | Default | 10 | 2 |邮政编码/库存
创建新库存。
请求正文:
{
"name": "Staging",
"description": "Staging environment",
"organization": 1,
"variables": {
"env": "staging"
}
}答复:
{
"id": 6,
"name": "Staging",
"created": "2025-11-01T22:00:00Z"
}模板服务器(端口8003)
POST/模板/{template_id}/启动
启动作业模板。
请求正文:
{
"extra_vars": {
"target_env": "production",
"backup_enabled": true
}
}答复:
| Operation | Status | Details |
|-----------|--------|---------|
| Launch Job Template | Success | Job ID: 157 started |有关API的完整文档,请参阅 API_REFERENCE.md.
用户服务器(端口8004)
GET/用户
列出所有用户。
答复:
| ID | Username | First Name | Last Name | Email |
|----|----------|------------|-----------|-------|
| 1 | admin | System | Administrator | admin@example.com |
| 2 | developer | John | Doe | john.doe@example.com |POST/用户
创建新用户。
请求正文:
{
"username": "newuser",
"first_name": "New",
"last_name": "User",
"email": "new@example.com",
"password": "secure_password"
}答复:
| Operation | Status | Details |
|-----------|--------|---------|
| Create User | Success | ID: 3, Name: newuser |项目服务器(端口8005)
GET/项目
列出所有项目。
答复:
| ID | Name | SCM Type | SCM URL | Status |
|----|------|----------|---------|--------|
| 1 | Demo Project | git | https://github.com/example/demo.git | successful |POST/项目
创建一个新项目。
请求正文:
{
"name": "New Project",
"scm_type": "git",
"scm_url": "https://github.com/example/new.git",
"organization": 1
}答复:
| Operation | Status | Details |
|-----------|--------|---------|
| Create Project | Success | ID: 2, Name: New Project |组织服务器(端口8006)
GET/组织
列出所有组织。
答复:
| ID | Name | Description | Created | Modified |
|----|------|-------------|---------|----------|
| 1 | Default | Default organization | 2025-09-13 15:39 | 2025-10-25 15:22 |计划服务器(端口8007)
GET/时间表
列出所有时间表。
答复:
| ID | Name | Template | RRULE | Enabled |
|----|------|----------|-------|---------|
| 1 | Daily Backup | 5 | FREQ=DAILY | Yes |POST/时间表
创建新计划。
请求正文:
{
"name": "Weekly Report",
"rrule": "FREQ=WEEKLY;BYDAY=MO",
"unified_job_template": 10
}答复:
| Operation | Status | Details |
|-----------|--------|---------|
| Create Schedule | Success | ID: 2, Name: Weekly Report |高级服务器(端口8008)
GET/凭据
列出所有凭据。
答复:
| ID | Name | Type | Created | Modified |
|----|------|------|---------|----------|
| 1 | AWS Creds | aws | 2025-09-13 15:39 | 2025-10-25 15:22 |通知服务器(端口8009)
GET/活动流
获取活动流事件。
答复:
| ID | Type | User | Action | Timestamp |
|----|------|------|--------|-----------|
| 123 | job | admin | launched | 2025-11-01 20:00 |基础结构服务器(端口8010)
GET/config
获取AWX系统配置。
答复:
| Property | Value |
|----------|-------|
| Version | 23.3.0 |
| License | Enterprise |
| Install Type | traditional |______________________________________________________________________
安全
认证
基本认证
所有端点(除 /health)需要身份验证:
curl -u username:password http://localhost:8001/pingJWT身份验证
- 获取JWT令牌:
curl -X POST http://localhost:8001/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"password"}'- 在请求中使用令牌:
curl -H "Authorization: Bearer " \
http://localhost:8002/inventories安全特性
干运行模式
未执行的测试操作:
curl -X DELETE "http://localhost:8002/inventories/5?dry_run=true"答复:
| Operation | Status | Details |
|-----------|--------|---------|
| Delete Inventory | Dry Run | Would delete inventory 'Staging' with 10 hosts |需要确认
破坏性操作需要明确确认:
curl -X DELETE "http://localhost:8002/inventories/5?confirm=true"没有 confirm=true,请求将被拒绝:
| Operation | Status | Details |
|-----------|--------|---------|
| Delete Inventory | Failed | Confirmation required - add '?confirm=true' |操作后验证
所有删除操作均验证完成情况:
| Operation | Status | Details |
|-----------|--------|---------|
| Delete Inventory | Success | Inventory deleted and verified (ID: 5) |审计日志
所有操作都记录到审核文件中:
日志位置: ${AUDIT_LOG_DIR}/mcp_server.log
日志格式:
{
"timestamp": "2025-11-01T22:00:00Z",
"user": "admin",
"action": "delete_inventory",
"resource_type": "inventory",
"resource_id": 5,
"success": true,
"source_ip": "192.168.1.100"
}网络安全
生产检查清单
- \[\]对AWX API使用HTTPS
- \[\]为Redis启用TLS
- \[\]配置防火墙规则
- \[\]使用Kubernetes网络策略
- \[\]启用JWT身份验证
- \[\]定期轮换凭据
- \[\]监控审核日志
- \[\]设置入侵检测
Kubernetes网络策略
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: mcp-server-policy
spec:
podSelector:
matchLabels:
tier: mcp-server
policyTypes:
- Ingress
- Egress
ingress:
- from:
- podSelector:
matchLabels:
app: gateway
ports:
- protocol: TCP
port: 8000
egress:
- to:
- podSelector:
matchLabels:
app: redis
ports:
- protocol: TCP
port: 6379
- to:
- namespaceSelector: {}
ports:
- protocol: TCP
port: 443 # AWX HTTPS______________________________________________________________________
监控
健康检查
配置健康监测:
Docker编写:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s库贝内特斯:
livenessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /ready
port: 8000
initialDelaySeconds: 5
periodSeconds: 10指标
Prometheus指标公布于 /metrics:
关键指标:
http_requests_total-HTTP请求总数http_request_duration_seconds-请求延迟awx_api_calls_total-AWX API调用awx_api_errors_total-AWX API错误cache_hits_total-Redis缓存命中率cache_misses_total-Redis缓存丢失
Prometheus配置:
scrape_configs:
- job_name: 'mcp-servers'
static_configs:
- targets:
- 'mcp-core:8001'
- 'mcp-inventory:8002'
- 'mcp-templates:8003'
# ... other servers日志记录
日志级别
通过环境设置:
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR, CRITICAL集中化的日志
ELK堆栈:
filebeat:
inputs:
- type: log
paths:
- /var/log/mcp/*.log
json.keys_under_root: true
output:
elasticsearch:
hosts: ["elasticsearch:9200"]洛基:
promtail:
config:
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: mcp-servers
static_configs:
- labels:
app: mcp-server
paths:
- /var/log/mcp/*.log告警
普罗米修斯警报规则:
groups:
- name: mcp-servers
rules:
- alert: HighErrorRate
expr: rate(http_requests_total{status=~"5.."}[5m]) > 0.05
for: 5m
annotations:
summary: "High error rate on {{ $labels.server }}"
- alert: AWXConnectionDown
expr: up{job="mcp-servers"} == 0
for: 2m
annotations:
summary: "AWX connection lost on {{ $labels.instance }}"______________________________________________________________________
故障排除
常见问题
1.服务器无法启动
症状: 集装箱立即出口
诊断:
docker logs mcp-server-core-1解决:
- 在中检查AWX凭据
.env - 验证AWX实例是否可访问
- 检查端口可用性:
netstat -tuln | grep 8001 - 审查环境变量:
docker compose config
2.AWX连接失败
症状: 健康检查失败, /ready 退货未准备好
诊断:
curl http://localhost:8001/ping解决:
- 验证AWX_BASE_URL是否正确
- 检查网络连接:
ping awx-server - 直接测试AWX API:
curl -u username:password https://awx-server/api/v2/ping- 检查防火墙规则
- 如果使用HTTPS,请验证SSL证书
3.内存使用率高
症状: 容器OOM填充,响应缓慢
诊断:
docker stats解决:
- 在中设置内存限制
docker-compose.yml:
deploy:
resources:
limits:
memory: 512M- 启用Redis缓存以减少API调用
- 横向扩展服务
- 审查审计日志中的异常活动
4.身份验证错误
症状: 401未经授权的响应
解决:
- 验证AWX凭据
- 检查令牌过期
- 重新生成AWX API令牌
- 查看身份验证尝试的审核日志
调试模式
启用调试日志记录:
LOG_LEVEL=DEBUG docker compose -f docker-compose.multi.yml up5.多服务器架构问题
症状: 一些服务器运行正常,但其他服务器没有响应
诊断:
# Check all servers individually
for port in {8001..8010}; do
echo "=== Port $port ==="
curl -s http://localhost:$port/health
echo
done解决:
- 确保所有10台服务器都已启动:
docker compose -f docker-compose.multi.yml up -d - 检查特定于服务器的日志:
docker logs mcp-server-core-1 - 验证端口可用性:
netstat -tuln | grep -E '800[1-9]|8010' - 检查共享卷装载情况
shared/目录
6.表格格式问题
症状: API返回纯文本而不是markdown表
诊断:
# Test table formatting
curl http://localhost:8002/inventories预期响应:
| ID | Name | Organization | Hosts Count | Groups Count |
|----|------|--------------|-------------|--------------|意外响应(纯文本):
count: 2
results: [...]解决:
- 确保
shared/table_formatter.py所有服务器都可以访问 - 检查Docker卷装载:
- ./shared:/app/shared - 验证服务器路由中的TableFormatter导入
- 代码更改后重新启动服务器
7.服务器特定连接问题
核心服务器(8001)问题:
# Test AWX connectivity
curl http://localhost:8001/test库存服务器(8002)问题:
# Test inventory access
curl http://localhost:8002/test模板服务器(8003)问题:
# Test template access
curl http://localhost:8003/test支持资源
- 文档:参见
/docs目录 - 问题:GitHub问题跟踪器
- 日志:检查
./logs/*/mcp_server.log - 健康:监视器
/health和/ready端点 - 多服务器健康检查:运行上面的loop命令检查所有服务器
______________________________________________________________________
发展
地方发展设置
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
# Run linter
ruff check .
# Run type checker
mypy app/项目结构
mcp-server/
├── app/ # Monolithic server (legacy)
│ ├── adapters/ # AWX adapters
│ ├── llm/ # LLM integration
│ └── ...
├── servers/ # Multi-server architecture
│ ├── core/ # Core server
│ ├── inventory/ # Inventory server
│ ├── templates/ # Templates server
│ └── ... # Other servers
├── shared/ # Shared libraries
│ ├── awx_client.py # Common AWX client
│ ├── config.py # Configuration
│ └── middleware.py # Common middleware
├── tests/ # Test suite
├── k8s/ # Kubernetes manifests
├── docs/ # Documentation
├── docker-compose.yml # Single server compose
├── docker-compose.multi.yml # Multi-server compose
└── README.md # This file添加新服务器
- 复制模板:
cp -r servers/_template servers/my-new-server- 更新文件:
servers/my-new-server/main.py-服务器配置servers/my-new-server/routes.py-API端点servers/my-new-server/schemas.py-Pydantic模型
- 添加到Docker Compose:
my-new-server:
build:
context: .
dockerfile: servers/my-new-server/Dockerfile
ports:
- "8011:8011"
environment:
- AWX_BASE_URL=${AWX_BASE_URL}
networks:
- mcp-network- 添加到Kubernetes:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mcp-my-new-server
spec:
replicas: 1
selector:
matchLabels:
app: mcp-my-new-server
template:
spec:
containers:
- name: my-new-server
image: awx-tools:my-new-server
ports:
- containerPort: 8000运行测试
# Run all tests
pytest
# Run specific test file
pytest tests/test_awx_service.py
# Run with coverage
pytest --cov=app --cov-report=html
# Run integration tests
pytest -m integration
# Run only unit tests
pytest -m "not integration"代码质量
# Lint code
ruff check . --fix
# Format code
ruff format .
# Type check
mypy --explicit-package-bases --ignore-missing-imports app/
# Security scan
bandit -r app/
safety scan______________________________________________________________________
贡献
我们欢迎捐款!请看 贡献.md 作为指导方针。
快速贡献指南
- 分叉存储库
- 创建特征分支:
git checkout -b feature/my-feature - 进行更改 并添加测试
- 进行质量检查:
ruff check . && mypy app/ && pytest - 提交:
git commit -m "feat: Add my feature" - 推:
git push origin feature/my-feature - 创建拉取请求
编码标准
- 遵循PEP 8风格指南
- 使用类型提示
- 为公共函数编写文档字符串
- 为新功能添加测试
- 更新文档
______________________________________________________________________
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
______________________________________________________________________
致谢
- 内置 快速API
- 由...驱动 Ansible AWX
- 受人工智能驱动的基础设施自动化需求的启发
______________________________________________________________________
更新日志
v2.0.0-多服务器架构(2025-11-01)
- \[专业\] 实现了10服务器微服务架构
- \[功能\] 为每个AWX域添加了专用服务器
- \[功能\] 针对小型LLM优化系统提示
- \[功能\] 完整的Kubernetes部署支持
- \[改进\] 每个端点的工具减少80%
- \[改进\] 响应令牌减少60%
- \[改进\] 增加了全面的健康检查
- \[文件\] 生产级文件
v1.0.0-初始版本
- 单体服务器
- AWX基本操作
- LLM集成
- Docker部署
有关详细的更改日志,请参阅 更改日志.md.
______________________________________________________________________
支持
- 文档: /docs
- 问题:
- 讨论:
______________________________________________________________________
AWX高级工具v2.0 -生产就绪的人工智能驱动的AWX自动化平台。
