Upgrading to nornir 3.x from 2.x
If you find some change not documented below don’t hesitate to open a PR or issue about it :)
Plugin Register
Introduced plugin register
Starting with nornir3 some plugins need to be registered. See plugins section for details.
Inventory
- Remove inventory deserializer
- Fixed
mypy
ParentGroups
is simplified__init__
functions are more explicit in order to improve correctness- Removed
add_host
andadd_group
- Removed
get_inventory_dict
,get_defaults_dict
,get_groups_dict
,get_hosts_dict
. Onlydict
remains - Inventory plugins need to be registered
- Transform functions need to be registered
InitNornir
- Passing callables as inventory plugin and transform functions is no longer supported
configure_logging
has been removed (it used to indicate it was to be deprecated)
Configuration
- Order of resolution for parameters is now InitNornir > config > environment
jinja2
can no longer be configured using the configurationnum_workers
is no longer acore
optionlogging.file
is nowlogging.log_file
- new
runner
section introduced
num_workers
Nornir used to accept num_workers
under the core configuration section. This used to instruct whether to use threads or not and how many. This has now changed with the introduction of runners. Now if you want to avoid using threads you would instruct nornir to use the SerialRunner
like this:
#config.yaml
runners:
plugin: serial
To tweak the number of threads:
#config.yaml
runners:
plugin: threaded
options:
num_workers: 100
For this same reason NORNIR_CORE_NUM_WORKERS
doesn’t work anymore. You should be able to do NORNIR_RUNNER_OPTIONS='{"num_threads": 100}'
instead.