feat: Ansible 15个运维模板 + 主机匹配 + 远程执行

**种子模板(15个):**
- 系统信息收集、安全更新、磁盘清理、服务巡检
- 用户SSH管理、Nginx配置、SSL证书检查、配置备份
- 进程诊断、Docker清理、防火墙、时间同步
- 日志轮转、内核调优、网络诊断
- 分类覆盖:maintenance/security/configuration/backup/monitoring

**主机匹配 API:**
- GET /api/v1/ansible/match-hosts?pattern=&match_type=regex|prefix|contains
- 支持正则/前缀/模糊匹配 hostname, IP, tags
- 复杂正则回退到 Go 过滤
- 分页支持

**远程执行增强:**
- 指定 target_hosts 时自动查询 SSH 信息生成临时 inventory
- 未指定时回退到 --connection=local
- 自动禁用 StrictHostKeyChecking
This commit is contained in:
attacker committed 2026-06-19 13:31:55 +00:00
1 parent 9af0685e90
commit c9b6647831
4 files changed
+528 -6

No files matched your search

+6 -2
View File
@@ -744,8 +744,12 @@ export const ansibleApi = {
batchDeletePlaybooks: async (ids: number[]) => {
return http.delete('/ansible/playbooks/batch-delete', { ids });
},
executePlaybook: async (id: number | string) => {
return http.post(`/ansible/playbooks/${id}/execute`);
executePlaybook: async (id: number | string, targetHosts?: string[]) => {
return http.post(`/ansible/playbooks/${id}/execute`, targetHosts ? { target_hosts: targetHosts } : undefined);
},
// 主机匹配预览 // Logan.Li
matchHosts: async (params: { pattern?: string; match_type?: string; page?: number; page_size?: number }) => {
return http.get<ListResponse>('/ansible/match-hosts', params);
},
// 任务执行记录
getJobs: async (params?: { page?: number; page_size?: number; status?: string }) => {