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
mypyParentGroupsis simplified__init__functions are more explicit in order to improve correctnessRemoved
add_hostandadd_groupRemoved
get_inventory_dict,get_defaults_dict,get_groups_dict,get_hosts_dict. OnlydictremainsInventory 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_logginghas been removed (it used to indicate it was to be deprecated)
Configuration
Order of resolution for parameters is now InitNornir > config > environment
jinja2can no longer be configured using the configurationnum_workersis no longer acoreoptionlogging.fileis nowlogging.log_filenew
runnersection 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_workers": 100}' instead.