mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
draft schema for inventory scripts (#39454)
* draft schema for inventory scripts used by the script inventory plugin * fixes and details for vars * proper escape * restrict additional
This commit is contained in:
parent
bc93038943
commit
3b8b928e29
1 changed files with 53 additions and 0 deletions
53
examples/inventory_script_schema.json
Normal file
53
examples/inventory_script_schema.json
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"title": "Ansible Inventory",
|
||||||
|
"description" : "Ansible Inventory for the script inventory plugin",
|
||||||
|
"type": "object",
|
||||||
|
"patternProperties": {
|
||||||
|
"^\\w$":{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"hosts": {
|
||||||
|
"description" : "list of hosts that are part of this group",
|
||||||
|
"type": "array",
|
||||||
|
"items": { "type": "string" }
|
||||||
|
},
|
||||||
|
"vars": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Variables to assign to hosts that are part of this group" ,
|
||||||
|
"patternProperties": {
|
||||||
|
"^\\w$":{ "type": "object", "description" : "Vars for this hosts in this group" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"description" : "list of groups that are children of this group, their hosts will be added to this group",
|
||||||
|
"type": "array",
|
||||||
|
"items": { "type": "string" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"_meta":{
|
||||||
|
"type": "object",
|
||||||
|
"description" : "Key that avoids calling the script per host",
|
||||||
|
"required": ["hostvars"],
|
||||||
|
"properties": {
|
||||||
|
"hostvars": {
|
||||||
|
"type": "object",
|
||||||
|
"description" : "Each key is a hostname and the value is a dictionary of the variables for that host",
|
||||||
|
"patternProperties": {
|
||||||
|
"^\\w$":{
|
||||||
|
"type": "object",
|
||||||
|
"description" : "Hosts with their associated vars",
|
||||||
|
"patternProperties": {
|
||||||
|
"^\\w$":{ "type": "object", "description" : "Vars for this host" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
Loading…
Reference in a new issue