|
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 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#assigning-a-variable-to-one-machine-host-variables", |
| 42 | + "title": "Host Variable" |
| 43 | + } |
| 44 | + }, |
| 45 | + "title": "Host", |
15 | 46 | "type": ["object", "null"] |
16 | 47 | } |
17 | 48 | }, |
18 | | - "type": ["object", "string"] |
| 49 | + "title": "Hosts", |
| 50 | + "type": ["object", "string", "null"] |
19 | 51 | }, |
20 | 52 | "vars": { |
21 | | - "type": "object" |
| 53 | + "additionalProperties": false, |
| 54 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#assigning-a-variable-to-many-machines-group-variables", |
| 55 | + "examples": [ |
| 56 | + { |
| 57 | + "ntp_server": "ntp.atlanta.example.com", |
| 58 | + "proxy": "proxy.atlanta.example.com" |
| 59 | + } |
| 60 | + ], |
| 61 | + "pattern": "^[a-zA-Z_]\\w*$", |
| 62 | + "patternProperties": { |
| 63 | + "^[a-zA-Z_]\\w*$": { |
| 64 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#assigning-a-variable-to-many-machines-group-variables", |
| 65 | + "title": "Group Variable" |
| 66 | + } |
| 67 | + }, |
| 68 | + "title": "Group Variables", |
| 69 | + "type": ["object", "string", "null"] |
22 | 70 | } |
23 | 71 | }, |
| 72 | + "title": "Group", |
24 | 73 | "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 | 74 | } |
44 | 75 | }, |
45 | 76 | "$id": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json", |
46 | 77 | "$schema": "http://json-schema.org/draft-07/schema", |
47 | | - "additionalProperties": true, |
| 78 | + "additionalProperties": false, |
48 | 79 | "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html", |
49 | 80 | "examples": [ |
50 | | - "inventory.yaml", |
51 | | - "inventory.yml", |
52 | | - "inventory/*.yml", |
53 | | - "inventory/*.yaml" |
| 81 | + { |
| 82 | + "dbservers": { |
| 83 | + "hosts": { |
| 84 | + "one.example.com": null, |
| 85 | + "three.example.com": null, |
| 86 | + "two.example.com": null |
| 87 | + } |
| 88 | + }, |
| 89 | + "ungrouped": { |
| 90 | + "hosts": { |
| 91 | + "mail.example.com": null |
| 92 | + } |
| 93 | + }, |
| 94 | + "webservers": { |
| 95 | + "hosts": { |
| 96 | + "bar.example.com": null, |
| 97 | + "foo.example.com": null |
| 98 | + } |
| 99 | + } |
| 100 | + }, |
| 101 | + { |
| 102 | + "atlanta": { |
| 103 | + "hosts": { |
| 104 | + "host1": { |
| 105 | + "http_port": 80, |
| 106 | + "maxRequestsPerChild": 808 |
| 107 | + }, |
| 108 | + "host2": { |
| 109 | + "http_port": 303, |
| 110 | + "maxRequestsPerChild": 909 |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | + }, |
| 115 | + { |
| 116 | + "webservers": { |
| 117 | + "hosts": { |
| 118 | + "www[01:50].example.com": null |
| 119 | + } |
| 120 | + } |
| 121 | + }, |
| 122 | + { |
| 123 | + "webservers": { |
| 124 | + "hosts": { |
| 125 | + "www[01:50:2].example.com": null |
| 126 | + } |
| 127 | + } |
| 128 | + } |
54 | 129 | ], |
55 | 130 | "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)", |
| 131 | + "patternProperties": { |
| 132 | + "^[a-zA-Z_]\\w*$": { |
| 133 | + "$ref": "#/$defs/group" |
| 134 | + } |
| 135 | + }, |
56 | 136 | "properties": { |
57 | 137 | "all": { |
58 | | - "$ref": "#/$defs/special-group" |
| 138 | + "$ref": "#/$defs/group", |
| 139 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#default-groups" |
59 | 140 | }, |
60 | 141 | "ungrouped": { |
61 | | - "$ref": "#/$defs/group" |
| 142 | + "$ref": "#/$defs/group", |
| 143 | + "description": "See https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#default-groups" |
62 | 144 | } |
63 | 145 | }, |
64 | | - "title": "Ansible Inventory Schema", |
65 | | - "type": "object" |
| 146 | + "title": "Ansible Inventory", |
| 147 | + "type": "object", |
| 148 | + "x-ansible-lint": [ |
| 149 | + "inventory.yaml", |
| 150 | + "inventory.yml", |
| 151 | + "inventory/*.yml", |
| 152 | + "inventory/*.yaml" |
| 153 | + ] |
66 | 154 | } |
0 commit comments