-
Notifications
You must be signed in to change notification settings - Fork 6
/
playbook.go
49 lines (40 loc) · 936 Bytes
/
playbook.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import "sort"
type Results struct {
Stats map[string]*Stats `json:"stats"`
Plays []*Play `json:"plays"`
}
// GetStatsList returns an ordered list of playbook names.
func (r *Results) GetStatsList() (stats []string) {
for stat := range r.Stats {
stats = append(stats, stat)
}
sort.Strings(stats)
return
}
type Stats struct {
Changed int `json:"changed"`
Failure int `json:"failure"`
Ok int `json:"ok"`
Skipped int `json:"skipped"`
Unreachable int `json:"unreachable"`
}
type Play struct {
Name *Name `json:"play"`
Tasks []*Task `json:"tasks"`
}
type Task struct {
Hosts map[string]*Host `json:"hosts"`
Name *Name `json:"task"`
}
type Name struct {
Name string `json:"name"`
}
func (n *Name) String() string {
return n.Name
}
type Host struct {
Failed bool `json:failed`
Unreachable bool `json:unreachable`
Msg string `json:msg`
}