|
1 | 1 | { |
2 | 2 | "$defs": { |
3 | 3 | "group": { |
| 4 | + "additionalProperties": false, |
| 5 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#inventory-basics-formats-hosts-and-groups", |
4 | 6 | "properties": { |
5 | 7 | "children": { |
| 8 | + "additionalProperties": false, |
| 9 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#grouping-groups-parent-child-group-relationships", |
| 10 | + "pattern": "^[a-zA-Z_]\\w*$", |
6 | 11 | "patternProperties": { |
7 | | - "[a-zA-Z-_0-9]": { |
| 12 | + "^[a-zA-Z_]\\w*$": { |
8 | 13 | "$ref": "#/$defs/group" |
9 | 14 | } |
10 | | - } |
| 15 | + }, |
| 16 | + "title": "Children", |
| 17 | + "type": ["object", "string", "null"] |
11 | 18 | }, |
12 | 19 | "hosts": { |
| 20 | + "additionalProperties": false, |
| 21 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#inventory-basics-formats-hosts-and-groups", |
| 22 | + "examples": [ |
| 23 | + { |
| 24 | + "foo.example.com": null |
| 25 | + }, |
| 26 | + "foo.example.com", |
| 27 | + { |
| 28 | + "www[01:50].example.com": null |
| 29 | + }, |
| 30 | + { |
| 31 | + "www[01:50:2].example.com": null |
| 32 | + } |
| 33 | + ], |
| 34 | + "minLength": 1, |
13 | 35 | "patternProperties": { |
14 | | - "[a-zA-Z.-_0-9]": { |
| 36 | + ".": { |
| 37 | + "additionalProperties": false, |
| 38 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#inventory-basics-formats-hosts-and-groups", |
| 39 | + "patternProperties": { |
| 40 | + "^[a-zA-Z_]\\w*$": { |
| 41 | + "title": "Host Variable" |
| 42 | + } |
| 43 | + }, |
| 44 | + "title": "Host", |
15 | 45 | "type": ["object", "null"] |
16 | 46 | } |
17 | 47 | }, |
18 | | - "type": ["object", "string"] |
| 48 | + "title": "Hosts", |
| 49 | + "type": ["object", "string", "null"] |
19 | 50 | }, |
20 | 51 | "vars": { |
21 | | - "type": "object" |
| 52 | + "additionalProperties": false, |
| 53 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#assigning-a-variable-to-one-machine-host-variables", |
| 54 | + "examples": [ |
| 55 | + { |
| 56 | + "ntp_server": "ntp.atlanta.example.com", |
| 57 | + "proxy": "proxy.atlanta.example.com" |
| 58 | + } |
| 59 | + ], |
| 60 | + "pattern": "^[a-zA-Z_]\\w*$", |
| 61 | + "patternProperties": { |
| 62 | + "^[a-zA-Z_]\\w*$": { |
| 63 | + "title": "Group Variable" |
| 64 | + } |
| 65 | + }, |
| 66 | + "title": "Group Variables", |
| 67 | + "type": ["object", "string", "null"] |
22 | 68 | } |
23 | 69 | }, |
| 70 | + "title": "Group", |
24 | 71 | "type": ["object", "null"] |
25 | | - }, |
26 | | - "special-group": { |
27 | | - "additionalProperties": false, |
28 | | - "properties": { |
29 | | - "children": { |
30 | | - "type": ["object", "null"] |
31 | | - }, |
32 | | - "groups": { |
33 | | - "type": ["object", "null"] |
34 | | - }, |
35 | | - "hosts": { |
36 | | - "type": ["object", "null"] |
37 | | - }, |
38 | | - "vars": { |
39 | | - "type": ["object", "null"] |
40 | | - } |
41 | | - }, |
42 | | - "type": "object" |
43 | 72 | } |
44 | 73 | }, |
45 | 74 | "$id": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json", |
46 | 75 | "$schema": "http://json-schema.org/draft-07/schema", |
47 | | - "additionalProperties": true, |
| 76 | + "additionalProperties": false, |
48 | 77 | "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html", |
49 | 78 | "examples": [ |
50 | | - "inventory.yaml", |
51 | | - "inventory.yml", |
52 | | - "inventory/*.yml", |
53 | | - "inventory/*.yaml" |
| 79 | + { |
| 80 | + "dbservers": { |
| 81 | + "hosts": { |
| 82 | + "one.example.com": null, |
| 83 | + "three.example.com": null, |
| 84 | + "two.example.com": null |
| 85 | + } |
| 86 | + }, |
| 87 | + "ungrouped": { |
| 88 | + "hosts": { |
| 89 | + "mail.example.com": null |
| 90 | + } |
| 91 | + }, |
| 92 | + "webservers": { |
| 93 | + "hosts": { |
| 94 | + "bar.example.com": null, |
| 95 | + "foo.example.com": null |
| 96 | + } |
| 97 | + } |
| 98 | + }, |
| 99 | + { |
| 100 | + "atlanta": { |
| 101 | + "hosts": { |
| 102 | + "host1": { |
| 103 | + "http_port": 80, |
| 104 | + "maxRequestsPerChild": 808 |
| 105 | + }, |
| 106 | + "host2": { |
| 107 | + "http_port": 303, |
| 108 | + "maxRequestsPerChild": 909 |
| 109 | + } |
| 110 | + } |
| 111 | + } |
| 112 | + }, |
| 113 | + { |
| 114 | + "webservers": { |
| 115 | + "hosts": { |
| 116 | + "www[01:50].example.com": null |
| 117 | + } |
| 118 | + } |
| 119 | + }, |
| 120 | + { |
| 121 | + "webservers": { |
| 122 | + "hosts": { |
| 123 | + "www[01:50:2].example.com": null |
| 124 | + } |
| 125 | + } |
| 126 | + } |
54 | 127 | ], |
55 | 128 | "markdownDescription": "All keys at top levels are groups with `all` and `ungrouped` having a special meaning.\n\nSee [How to build your inventory](https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html)", |
| 129 | + "patternProperties": { |
| 130 | + "^[a-zA-Z_]\\w*$": { |
| 131 | + "$ref": "#/$defs/group" |
| 132 | + } |
| 133 | + }, |
56 | 134 | "properties": { |
57 | 135 | "all": { |
58 | | - "$ref": "#/$defs/special-group" |
| 136 | + "$ref": "#/$defs/group", |
| 137 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#default-groups" |
59 | 138 | }, |
60 | 139 | "ungrouped": { |
61 | | - "$ref": "#/$defs/group" |
| 140 | + "$ref": "#/$defs/group", |
| 141 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#default-groups" |
62 | 142 | } |
63 | 143 | }, |
64 | | - "title": "Ansible Inventory Schema", |
| 144 | + "title": "Ansible Inventory", |
65 | 145 | "type": "object" |
66 | 146 | } |
0 commit comments