Skip to content

Instantly share code, notes, and snippets.

@ubaumann
Last active January 31, 2022 18:07
Show Gist options
  • Select an option

  • Save ubaumann/9242df49e88f5f686bcd11792a81f163 to your computer and use it in GitHub Desktop.

Select an option

Save ubaumann/9242df49e88f5f686bcd11792a81f163 to your computer and use it in GitHub Desktop.
Nornir Configuration JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema/schemas/config.json",
"type": "object",
"$ref": "#/definitions/Configuration",
"definitions": {
"Configuration": {
"type": "object",
"additionalProperties": false,
"properties": {
"inventory": {
"$ref": "#/definitions/Inventory"
},
"runner": {
"$ref": "#/definitions/Runner"
},
"ssh": {
"$ref": "#/definitions/SSH"
},
"logging": {
"$ref": "#/definitions/Logging"
},
"core": {
"$ref": "#/definitions/Core"
},
"user_defined": {
"type": "object",
"title": "User Defined",
"description": "You can set any <k, v> pair you want here and you will have it available under your configuration object, i.e. nr.config.user_defined.my_app_option"
}
},
"required": [],
"title": "Configuration"
},
"Core": {
"type": "object",
"additionalProperties": false,
"properties": {
"raise_on_error": {
"type": "boolean",
"title": "Raise on Error",
"description": "If set to True, nornir.core.Nornir.run method of will raise exception nornir.core.exceptions.NornirExecutionError if at least a host failed",
"default": false
}
},
"required": [],
"title": "Core"
},
"Inventory": {
"type": "object",
"additionalProperties": false,
"properties": {
"plugin": {
"type": "string",
"description": "Inventory plugin to use. Must be registered",
"title": "Inventory Plugin",
"default": "SimpleInventory"
},
"options": {
"type": "object",
"description": "Kwargs to pass to the plugin",
"title": "Inventory Options",
"default": {}
},
"transform_function": {
"type": "string",
"description": "Plugin to use. Must be registered",
"title": "Transform Function",
"default": null
},
"transform_function_options": {
"type": "object",
"description": "Kwargs to pass to the plugin",
"title": "Inventory Transform Function Options",
"default": {}
}
},
"required": [],
"title": "Inventory"
},
"Logging": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean",
"description": "Whether to configure logging or not",
"title": "Logging Enabled",
"default": null
},
"level": {
"type": "string",
"enum": [
"CRITICAL",
"FATAL",
"ERROR",
"WARN",
"WARNING",
"INFO",
"DEBUG",
"NOTSET"
],
"description": "Setting the logging level. Default is INFO",
"title": "Logging Level",
"default": "INFO"
},
"log_file": {
"type": "string",
"description": "Logging file",
"title": "Logging Logging File",
"default": "nornir.log"
},
"format": {
"type": "string",
"description": "Logging format",
"title": "Logging Format",
"default": "%(asctime)s - %(name)12s - %(levelname)8s - %(funcName)10s() - %(message)s"
},
"to_console": {
"type": "boolean",
"description": "Whether to log to console or not",
"title": "Logging to Console",
"default": false
},
"loggers": {
"type": "array",
"description": "Loggers to configure",
"title": "Logging Loggers",
"default": [
"nornir"
],
"items": {
"type": "string"
}
}
},
"required": [],
"title": "Logging"
},
"Runner": {
"type": "object",
"additionalProperties": false,
"properties": {
"options": {
"type": "object",
"description": "Kwargs to pass to the plugin",
"title": "Runner Options",
"default": {}
},
"plugin": {
"type": "string",
"description": "Plugin to use as Runner. Must be registered",
"title": "Runner Plugin",
"default": "Threaded"
}
},
"required": [],
"title": "Runner"
},
"SSH": {
"type": "object",
"additionalProperties": false,
"properties": {
"config_file": {
"type": "string",
"description": "Path to ssh configuration file",
"title": "SSH Config File",
"default": "~/.ssh/config"
}
},
"required": [],
"title": "SSH"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment