コード例 #1
0
def netconf(request):
    """Initializes nornir"""
    dir_path = os.path.dirname(os.path.realpath(__file__))

    nornir = InitNornir(
        inventory={
            "options": {
                "host_file":
                "{}/inventory_data/netconf_hosts.yaml".format(dir_path)
            }
        },
        dry_run=True,
    )
    nornir.data = global_data
    return nornir
コード例 #2
0
def nr(request):
    """Initializes nornir"""
    dir_path = os.path.dirname(os.path.realpath(__file__))

    nornir = InitNornir(
        inventory={
            "plugin": "SimpleInventory",
            "options": {
                "host_file": f"{dir_path}/inventory_data/hosts.yaml",
                "group_file": f"{dir_path}/inventory_data/groups.yaml",
                "defaults_file": f"{dir_path}/inventory_data/defaults.yaml",
            },
        },
        dry_run=True,
    )
    nornir.data = global_data
    return nornir
コード例 #3
0
def nornir_generic():
    """Initializes nornir"""
    dir_path = os.path.dirname(os.path.realpath(__file__))

    nornir = InitNornir(
        inventory={
            "options": {
                "host_file":
                "{}/inventory_data/hosts_generic.yaml".format(dir_path),
                "group_file":
                "{}/inventory_data/groups.yaml".format(dir_path),
                "defaults_file":
                "{}/inventory_data/defaults.yaml".format(dir_path),
            }
        },
        dry_run=True,
    )
    nornir.data = global_data
    return nornir
コード例 #4
0
def nornir():
    """Initializes nornir"""
    nr_nr = InitNornir(
        inventory={
            "plugin": "SimpleInventory",
            "options": {
                "host_file": f"{DIR_PATH}/inventory_data/hosts.yaml",
                "group_file": f"{DIR_PATH}/inventory_data/groups.yaml",
                "defaults_file": f"{DIR_PATH}/inventory_data/defaults.yaml",
            },
        },
        logging={
            "log_file": f"{DIR_PATH}/unit/test_data/nornir_test.log",
            "level": "DEBUG",
        },
        dry_run=True,
    )
    nr_nr.data = global_data
    return nr_nr
コード例 #5
0
def nornir(request):
    """Initializes nornir"""
    dir_path = os.path.dirname(os.path.realpath(__file__))

    nornir = InitNornir(
        inventory={
            "plugin": "nornir_ansible.inventory.ansible.AnsibleInventory",
            "options": {
                "host_file":
                "{}/inventory_data/hosts.yaml".format(dir_path),
                "group_file":
                "{}/inventory_data/groups.yaml".format(dir_path),
                "defaults_file":
                "{}/inventory_data/defaults.yaml".format(dir_path),
            },
        },
        dry_run=True,
    )
    nornir.data = global_data
    return nornir