SSH-Infrastructure / schema / hosts.schema.json
Newer Older
159 lines | 4.516kb
Bogdan Timofte authored 2 weeks ago
1
{
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
  "$id": "https://next-gen.local/ssh-infrastructure/hosts.schema.json",
4
  "title": "SSH infrastructure inventory",
5
  "type": "object",
6
  "required": ["version", "defaults", "entrypoints", "jumps", "groups"],
7
  "additionalProperties": false,
8
  "properties": {
9
    "version": { "const": 1 },
10
    "facts": { "type": "object" },
11
    "ssh_options": {
12
      "type": "object",
13
      "additionalProperties": {
14
        "type": "object",
15
        "required": ["options"],
16
        "additionalProperties": false,
17
        "properties": {
18
          "description": { "type": "string" },
19
          "options": {
20
            "type": "object",
21
            "additionalProperties": {
22
              "anyOf": [
23
                { "type": "string" },
24
                { "type": "integer" },
25
                { "type": "boolean" }
26
              ]
27
            }
28
          }
29
        }
30
      }
31
    },
32
    "company_managed": {
33
      "type": "object",
34
      "additionalProperties": false,
35
      "properties": {
36
        "jump_hosts": {
37
          "type": "object",
38
          "additionalProperties": false,
39
          "properties": {
40
            "inherit_globals_on_targets": {
41
              "type": "array",
42
              "items": { "type": "string" }
43
            },
44
            "match_defaults": {
45
              "type": "array",
46
              "items": { "$ref": "#/$defs/companyManagedMatch" }
47
            }
48
          }
49
        }
50
      }
51
    },
52
    "defaults": {
53
      "type": "object",
54
      "required": ["jump", "final_host"],
55
      "additionalProperties": false,
56
      "properties": {
57
        "jump": { "$ref": "#/$defs/defaults" },
58
        "final_host": { "$ref": "#/$defs/defaults" }
59
      }
60
    },
61
    "entrypoints": {
62
      "type": "object",
63
      "additionalProperties": { "$ref": "#/$defs/host" }
64
    },
65
    "jumps": {
66
      "type": "object",
67
      "additionalProperties": {
68
        "allOf": [
69
          { "$ref": "#/$defs/host" },
70
          {
71
            "type": "object",
72
            "properties": {
73
              "role": { "type": "string" }
74
            }
75
          }
76
        ]
77
      }
78
    },
79
    "groups": {
80
      "type": "object",
81
      "additionalProperties": {
82
        "type": "object",
83
        "required": ["hosts"],
84
        "additionalProperties": false,
85
        "properties": {
86
          "description": { "type": "string" },
87
          "default_jump": { "type": "string" },
88
          "defaults": { "$ref": "#/$defs/defaults" },
89
          "patterns": {
90
            "type": "object",
91
            "additionalProperties": { "$ref": "#/$defs/options" }
92
          },
93
          "hosts": {
94
            "type": "object",
95
            "additionalProperties": { "$ref": "#/$defs/host" }
96
          }
97
        }
98
      }
99
    }
100
  },
101
  "$defs": {
102
    "defaults": {
103
      "type": "object",
104
      "additionalProperties": false,
105
      "properties": {
106
        "user": { "type": "string" },
107
        "port": { "type": "integer", "minimum": 1, "maximum": 65535 },
108
        "connect_timeout": { "type": "integer", "minimum": 1 },
109
        "connection_attempts": { "type": "integer", "minimum": 1 },
110
        "auth": { "$ref": "#/$defs/auth" }
111
      }
112
    },
113
    "options": {
114
      "type": "object",
115
      "additionalProperties": false,
116
      "properties": {
117
        "connect_timeout": { "type": "integer", "minimum": 1 },
118
        "connection_attempts": { "type": "integer", "minimum": 1 }
119
      }
120
    },
121
    "companyManagedMatch": {
122
      "type": "object",
123
      "required": ["patterns"],
124
      "additionalProperties": false,
125
      "properties": {
126
        "patterns": {
127
          "type": "array",
128
          "minItems": 1,
129
          "items": { "type": "string" }
130
        },
131
        "user": { "type": "string" },
132
        "port": { "type": "integer", "minimum": 1, "maximum": 65535 }
133
      }
134
    },
135
    "host": {
136
      "type": "object",
137
      "required": ["aliases", "hostname"],
138
      "additionalProperties": false,
139
      "properties": {
140
        "aliases": {
141
          "type": "array",
142
          "minItems": 1,
143
          "items": { "type": "string" }
144
        },
145
        "hostname": { "type": "string" },
146
        "user": { "type": "string" },
147
        "port": { "type": "integer", "minimum": 1, "maximum": 65535 },
148
        "identity_file": { "type": "string" },
149
        "identities_only": { "type": "boolean" },
150
        "role": { "type": "string" },
151
        "auth": { "$ref": "#/$defs/auth" }
152
      }
153
    },
154
    "auth": {
155
      "type": "string",
156
      "enum": ["key", "password_interactive"]
157
    }
158
  }
159
}