fix: all组显示所有主机 + playbook warn模块改为debug

This commit is contained in:
Hermes Agent
2026-05-18 17:26:51 +08:00
parent d58e860059
commit ecb8afd732
4 changed files with 39 additions and 33 deletions
+7 -1
View File
@@ -275,6 +275,12 @@ func (s *AnsibleService) ListGroups() []models.HostGroup {
// 动态展开组内主机(通过 host.Groups 字段关联,而非 group.Hosts
var hostList []models.Host
for _, h := range s.hosts {
if gcopy.Name == "all" {
// all 组包含所有主机
hcopy := *h
hostList = append(hostList, hcopy)
continue
}
for _, hGroup := range h.Groups {
if hGroup == gcopy.Name {
hcopy := *h
@@ -282,7 +288,7 @@ func (s *AnsibleService) ListGroups() []models.HostGroup {
break
}
}
// 也检查主机的默认组(all/ungrouped
// 也检查主机的默认组(ungrouped)
if len(h.Groups) == 0 && gcopy.Name == "ungrouped" {
hcopy := *h
hostList = append(hostList, hcopy)