nornir.init_nornir

nornir.init_nornir.InitNornir(config_file: str = '', dry_run: bool = False, *, inventory: dict[str, Any] | None = None, ssh: dict[str, Any] | None = None, logging: dict[str, Any] | None = None, core: dict[str, Any] | None = None, runner: dict[str, Any] | None = None, user_defined: dict[str, Any] | None = None) Nornir

Instantiate and configure a Nornir object.

Parameters:
  • config_file (str) – Path to the configuration file (optional)

  • dry_run (bool) – Whether to simulate changes or not

  • inventory (dict) – Inventory configuration section

  • ssh (dict) – SSH configuration section

  • logging (dict) – Logging configuration section

  • core (dict) – Core configuration section

  • runner (dict) – Runner configuration section

  • user_defined (dict) – User-defined configuration section

Returns:

fully instantiated and configured

Return type:

nornir.core.Nornir

nornir.init_nornir.load_inventory(config: Config) Inventory

Build the inventory the configuration asks for.

The inventory plugin named in config.inventory.plugin is instantiated with config.inventory.options and asked to load. When a transform function is configured it is then applied to every host in turn.

Parameters:

config – Configuration to read the inventory settings from

Returns:

The loaded inventory.

Return type:

nornir.core.inventory.Inventory

Raises:

nornir.core.exceptions.PluginNotRegistered – no plugin is registered under the configured name

nornir.init_nornir.load_runner(config: Config) RunnerPlugin

Build the runner the configuration asks for.

Parameters:

config – Configuration to read the runner settings from

Returns:

The plugin named in config.runner.plugin, instantiated with config.runner.options.

Return type:

nornir.core.plugins.runners.RunnerPlugin

Raises:

nornir.core.exceptions.PluginNotRegistered – no plugin is registered under the configured name