Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
此分支针对task模块中的ansible任务进行修改,在原来的基础上增加了更多了功能,包括ansible的更多参数支持,ansible定时任务和ansible历史任务记录等,基本功能已完成测试,能够满足一般复杂的需求,后续会针对这块进行性能优化调整和Bug修复。
注意:此模块
🚀 Feat: Ansible 任务模块功能增强与重构
本次提交对 Ansible 任务模块进行了深度的功能迭代,主要集中在任务历史记录管理、周期性任务支持、配置中心集成以及 API 文档的规范化。
✨ 核心功能更新
1. 任务执行历史记录体系 (History & Logging)
TaskAnsibleHistory表记录每次执行的任务状态、耗时和触发者。TaskAnsibleworkHistory表记录子任务(Playbook 级别)的详细执行结果。RunID(时间戳)的物理日志目录隔离(logs/ansible/{taskID}/{workID}/{timestamp}/),防止多次执行日志互相覆盖。MaxHistoryKeep字段配置保留最近 N 次历史记录,自动清理旧的数据库记录及磁盘日志文件。SSE(Server-Sent Events) 接口的兼容性升级,支持实时日志与历史日志的无缝切换。2. 配置中心深度集成
ConfigCenter) 的各项配置,包括:Inventory(主机清单)GlobalVars(全局变量)ExtraVars(额外变量)CliArgs(命令行参数)use_config=1,系统将在运行时动态拉取最新配置覆盖本地文件,实现了任务定义与配置数据的解耦。3. 任务调度与周期性支持
CronExpr(Cron 表达式) 和IsRecurring(是否周期任务) 字段。ViewID字段,支持将任务归类到不同的视图中进行管理。4. API 接口与文档优化
docs.go拆分为 task, cmdb 等子模块,便于维护。CreateTask和UpdateTask接口现已完整支持所有新增参数(包括配置ID、Cron表达式、Playbook路径等)。-Swagger 文档已同步更新,支持完整参数的在线调试。
DELETE /api/v1/task/ansible/{id}/history/{history_id}: 删除指定历史记录及物理文件。GET /api/v1/task/ansible/history/...: 丰富的历史记录查询接口族。🛠 数据库模型变更 (
TaskAnsible)MaxHistoryKeepintCronExprstringIsRecurringintViewIDuintInventoryConfigIDuintUseConfigint🧪 测试验证
MaxHistoryKeep次数,验证旧记录和磁盘文件被物理删除。