Beispiel #1
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            type=dict(
                required=True,
                choices=[
                    "8p8c", "110-punch", "bnc", "mrj21", "fc", "lc", "lc-apc",
                    "lsh", "lsh-apc", "mpo", "mtrj", "sc", "sc-apc", "st"
                ],
                type="str",
            ),
            positions=dict(required=False, type="int"),
            description=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    rear_port = NautobotDcimModule(module, NB_REAR_PORTS)
    rear_port.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            manufacturer=dict(required=False, type="raw"),
            model=dict(required=True, type="raw"),
            slug=dict(required=False, type="str"),
            part_number=dict(required=False, type="str"),
            u_height=dict(required=False, type="int"),
            is_full_depth=dict(required=False, type="bool"),
            subdevice_role=dict(
                required=False,
                choices=["Parent", "parent", "Child", "child"],
                type="str",
            ),
            comments=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
            custom_fields=dict(required=False, type="dict"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    device_type = NautobotDcimModule(module, NB_DEVICE_TYPES)
    device_type.run()
Beispiel #3
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            update_vc_child=dict(type="bool", required=False, default=False),
            device=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            label=dict(required=False, type="str"),
            type=dict(required=False, type="str"),
            enabled=dict(required=False, type="bool"),
            lag=dict(required=False, type="raw"),
            mtu=dict(required=False, type="int"),
            mac_address=dict(required=False, type="str"),
            mgmt_only=dict(required=False, type="bool"),
            description=dict(required=False, type="str"),
            mode=dict(required=False, type="raw"),
            untagged_vlan=dict(required=False, type="raw"),
            tagged_vlans=dict(required=False, type="raw"),
            tags=dict(required=False, type="list", elements="raw"),
            custom_fields=dict(required=False, type="dict"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    device_interface = NautobotDcimModule(module,
                                          NB_INTERFACES,
                                          remove_keys=["update_vc_child"])
    device_interface.run()
Beispiel #4
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            facility_id=dict(required=False, type="str"),
            site=dict(required=False, type="raw"),
            rack_group=dict(required=False, type="raw"),
            tenant=dict(required=False, type="raw"),
            status=dict(required=False, type="raw"),
            rack_role=dict(required=False, type="raw"),
            serial=dict(required=False, type="str"),
            asset_tag=dict(required=False, type="str"),
            type=dict(
                required=False,
                type="str",
                choices=[
                    "2-post frame", "4-post frame", "4-post cabinet",
                    "Wall-mounted frame", "Wall-mounted cabinet"
                ],
            ),
            width=dict(required=False, type="int", choices=[10, 19, 21, 23]),
            u_height=dict(required=False, type="int"),
            desc_units=dict(required=False, type="bool"),
            outer_width=dict(required=False, type="int"),
            outer_depth=dict(required=False, type="int"),
            outer_unit=dict(
                required=False,
                type="str",
                choices=["Millimeters", "Inches"],
            ),
            comments=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
            custom_fields=dict(required=False, type="dict"),
        ))

    required_if = [
        ("state", "present", ["name", "status"]),
        ("state", "absent", ["name"]),
    ]

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True,
                           required_if=required_if)

    rack = NautobotDcimModule(module, NB_RACKS)
    rack.run()
Beispiel #5
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            device_type=dict(required=False, type="raw"),
            device_role=dict(required=False, type="raw"),
            tenant=dict(required=False, type="raw"),
            platform=dict(required=False, type="raw"),
            serial=dict(required=False, type="str"),
            asset_tag=dict(required=False, type="str"),
            site=dict(required=False, type="raw"),
            rack=dict(required=False, type="raw"),
            position=dict(required=False, type="int"),
            face=dict(
                required=False,
                type="str",
                choices=["Front", "front", "Rear", "rear"],
            ),
            status=dict(required=False, type="raw"),
            primary_ip4=dict(required=False, type="raw"),
            primary_ip6=dict(required=False, type="raw"),
            cluster=dict(required=False, type="raw"),
            virtual_chassis=dict(required=False, type="raw"),
            vc_position=dict(required=False, type="int"),
            vc_priority=dict(required=False, type="int"),
            comments=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
            local_context_data=dict(required=False, type="dict"),
            custom_fields=dict(required=False, type="dict"),
        ))

    required_if = [
        ("state", "present", ["name", "status"]),
        ("state", "absent", ["name"]),
    ]

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True,
                           required_if=required_if)
    if module.params["name"] == "":
        module.params["name"] = str(uuid.uuid4())

    device = NautobotDcimModule(module, NB_DEVICES)
    device.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device_type=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            type=dict(
                required=True,
                choices=[
                    "8p8c",
                    "8p6c",
                    "8p4c",
                    "8p2c",
                    "gg45",
                    "tera-4p",
                    "tera-2p",
                    "tera-1p",
                    "110-punch",
                    "bnc",
                    "mrj21",
                    "st",
                    "sc",
                    "sc-apc",
                    "fc",
                    "lc",
                    "lc-apc",
                    "mtrj",
                    "mpo",
                    "lsh",
                    "lsh-apc",
                    "splice",
                    "cs",
                    "sn",
                ],
                type="str",
            ),
            rear_port_template=dict(required=True, type="raw"),
            rear_port_template_position=dict(required=False, type="int"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    front_port_template = NautobotDcimModule(module, NB_FRONT_PORT_TEMPLATES)
    front_port_template.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device_type=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    device_bay_template = NautobotDcimModule(module, NB_DEVICE_BAY_TEMPLATES)
    device_bay_template.run()
Beispiel #8
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            slug=dict(required=False, type="str"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    manufacturer = NautobotDcimModule(module, NB_MANUFACTURERS)
    manufacturer.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            site=dict(required=True, type="raw"),
            rack_group=dict(required=False, type="raw"),
            name=dict(required=True, type="str"),
        )
    )

    module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

    power_panel = NautobotDcimModule(module, NB_POWER_PANELS)
    power_panel.run()
Beispiel #10
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            slug=dict(required=False, type="str"),
            parent_region=dict(required=False, type="raw"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    region = NautobotDcimModule(module, NB_REGIONS)
    region.run()
Beispiel #11
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            slug=dict(required=False, type="str"),
            color=dict(required=False, type="str"),
        )
    )

    module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

    rack_role = NautobotDcimModule(module, NB_RACK_ROLES)
    rack_role.run()
Beispiel #12
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            master=dict(required=False, type="raw"),
            domain=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
        )
    )

    module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

    virtual_chassis = NautobotDcimModule(module, NB_VIRTUAL_CHASSIS)
    virtual_chassis.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device=dict(required=False, type="raw"),
            name=dict(required=True, type="str"),
            description=dict(required=False, type="str"),
            installed_device=dict(required=False, type="raw"),
            tags=dict(required=False, type="list", elements="raw"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    device_bay = NautobotDcimModule(module, NB_DEVICE_BAYS)
    device_bay.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            power_panel=dict(required=True, type="raw"),
            rack=dict(required=False, type="raw"),
            name=dict(required=True, type="str"),
            status=dict(
                required=False,
                type="str",
            ),
            type=dict(required=False,
                      choices=["primary", "redundant"],
                      type="str"),
            supply=dict(required=False, choices=["ac", "dc"], type="str"),
            phase=dict(
                required=False,
                choices=["single-phase", "three-phase"],
                type="str",
            ),
            voltage=dict(required=False, type="int"),
            amperage=dict(required=False, type="int"),
            max_utilization=dict(required=False, type="int"),
            comments=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
            custom_fields=dict(required=False, type="dict"),
        ))

    required_if = [
        ("state", "present", ["power_panel", "name", "status"]),
        ("state", "absent", ["power_panel", "name"]),
    ]

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True,
                           required_if=required_if)

    power_feed = NautobotDcimModule(module, NB_POWER_FEEDS)
    power_feed.run()
Beispiel #15
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            slug=dict(required=False, type="str"),
            description=dict(required=False, type="str"),
            manufacturer=dict(required=False, type="raw"),
            napalm_driver=dict(required=False, type="str"),
            napalm_args=dict(required=False, type="dict"),
        )
    )

    module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

    platform = NautobotDcimModule(module, NB_PLATFORMS)
    platform.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device_type=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            type=dict(
                required=True,
                type="str",
            ),
            mgmt_only=dict(required=False, type="bool"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    device_interface_template = NautobotDcimModule(module,
                                                   NB_INTERFACE_TEMPLATES)
    device_interface_template.run()
Beispiel #17
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            name=dict(required=True, type="str"),
            status=dict(required=False, type="raw"),
            region=dict(required=False, type="raw"),
            tenant=dict(required=False, type="raw"),
            facility=dict(required=False, type="str"),
            asn=dict(required=False, type="int"),
            time_zone=dict(required=False, type="str"),
            description=dict(required=False, type="str"),
            physical_address=dict(required=False, type="str"),
            shipping_address=dict(required=False, type="str"),
            latitude=dict(required=False, type="str"),
            longitude=dict(required=False, type="str"),
            contact_name=dict(required=False, type="str"),
            contact_phone=dict(required=False, type="str"),
            contact_email=dict(required=False, type="str"),
            comments=dict(required=False, type="str"),
            slug=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
            custom_fields=dict(required=False, type="dict"),
        ))

    required_if = [
        ("state", "present", ["name", "status"]),
        ("state", "absent", ["name"]),
    ]

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True,
                           required_if=required_if)

    site = NautobotDcimModule(module, NB_SITES)
    site.run()
Beispiel #18
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            manufacturer=dict(required=False, type="raw"),
            part_id=dict(required=False, type="str"),
            serial=dict(required=False, type="str"),
            asset_tag=dict(required=False, type="str"),
            description=dict(required=False, type="str"),
            discovered=dict(required=False, type="bool", default=False),
            tags=dict(required=False, type="list", elements="raw"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    inventory_item = NautobotDcimModule(module, NB_INVENTORY_ITEMS)
    inventory_item.run()
Beispiel #19
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            type=dict(
                required=False,
                choices=[
                    "de-9",
                    "db-25",
                    "rj-11",
                    "rj-12",
                    "rj-45",
                    "usb-a",
                    "usb-b",
                    "usb-c",
                    "usb-mini-a",
                    "usb-mini-b",
                    "usb-micro-a",
                    "usb-micro-b",
                    "other",
                ],
                type="str",
            ),
            description=dict(required=False, type="str"),
            tags=dict(required=False, type="list", elements="raw"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    console_server_port = NautobotDcimModule(module, NB_CONSOLE_SERVER_PORTS)
    console_server_port.run()
Beispiel #20
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device_type=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            type=dict(
                required=False,
                choices=[
                    "de-9",
                    "db-25",
                    "rj-11",
                    "rj-12",
                    "rj-45",
                    "usb-a",
                    "usb-b",
                    "usb-c",
                    "usb-mini-a",
                    "usb-mini-b",
                    "usb-micro-a",
                    "usb-micro-b",
                    "other",
                ],
                type="str",
            ),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    console_port_template = NautobotDcimModule(module,
                                               NB_CONSOLE_PORT_TEMPLATES)
    console_port_template.run()
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device_type=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            type=dict(
                required=False,
                choices=[
                    "iec-60320-c6",
                    "iec-60320-c8",
                    "iec-60320-c14",
                    "iec-60320-c16",
                    "iec-60320-c20",
                    "iec-60309-p-n-e-4h",
                    "iec-60309-p-n-e-6h",
                    "iec-60309-p-n-e-9h",
                    "iec-60309-2p-e-4h",
                    "iec-60309-2p-e-6h",
                    "iec-60309-2p-e-9h",
                    "iec-60309-3p-e-4h",
                    "iec-60309-3p-e-6h",
                    "iec-60309-3p-e-9h",
                    "iec-60309-3p-n-e-4h",
                    "iec-60309-3p-n-e-6h",
                    "iec-60309-3p-n-e-9h",
                    "nema-5-15p",
                    "nema-5-20p",
                    "nema-5-30p",
                    "nema-5-50p",
                    "nema-6-15p",
                    "nema-6-20p",
                    "nema-6-30p",
                    "nema-6-50p",
                    "nema-l5-15p",
                    "nema-l5-20p",
                    "nema-l5-30p",
                    "nema-l5-50p",
                    "nema-l6-20p",
                    "nema-l6-30p",
                    "nema-l6-50p",
                    "nema-l14-20p",
                    "nema-l14-30p",
                    "nema-l21-20p",
                    "nema-l21-30p",
                    "cs6361c",
                    "cs6365c",
                    "cs8165c",
                    "cs8265c",
                    "cs8365c",
                    "cs8465c",
                    "ita-e",
                    "ita-f",
                    "ita-ef",
                    "ita-g",
                    "ita-h",
                    "ita-i",
                    "ita-j",
                    "ita-k",
                    "ita-l",
                    "ita-m",
                    "ita-n",
                    "ita-o",
                ],
                type="str",
            ),
            allocated_draw=dict(required=False, type="int"),
            maximum_draw=dict(required=False, type="int"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    power_port_template = NautobotDcimModule(module, NB_POWER_PORT_TEMPLATES)
    power_port_template.run()
Beispiel #22
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            termination_a_type=dict(
                required=True,
                choices=[
                    "circuits.circuittermination",
                    "dcim.consoleport",
                    "dcim.consoleserverport",
                    "dcim.frontport",
                    "dcim.interface",
                    "dcim.powerfeed",
                    "dcim.poweroutlet",
                    "dcim.powerport",
                    "dcim.rearport",
                ],
                type="str",
            ),
            termination_a=dict(required=True, type="raw"),
            termination_b_type=dict(
                required=True,
                choices=[
                    "circuits.circuittermination",
                    "dcim.consoleport",
                    "dcim.consoleserverport",
                    "dcim.frontport",
                    "dcim.interface",
                    "dcim.powerfeed",
                    "dcim.poweroutlet",
                    "dcim.powerport",
                    "dcim.rearport",
                ],
                type="str",
            ),
            termination_b=dict(required=True, type="raw"),
            type=dict(
                required=False,
                choices=[
                    "cat3",
                    "cat5",
                    "cat5e",
                    "cat6",
                    "cat6a",
                    "cat7",
                    "dac-active",
                    "dac-passive",
                    "mrj21-trunk",
                    "coaxial",
                    "mmf",
                    "mmf-om1",
                    "mmf-om2",
                    "mmf-om3",
                    "mmf-om4",
                    "smf",
                    "smf-os1",
                    "smf-os2",
                    "aoc",
                    "power",
                ],
                type="str",
            ),
            status=dict(
                required=False,
                type="str",
            ),
            label=dict(required=False, type="str"),
            color=dict(required=False, type="str"),
            length=dict(required=False, type="int"),
            length_unit=dict(required=False,
                             choices=["m", "cm", "ft", "in"],
                             type="str"),
        ))

    required_if = [
        (
            "state",
            "present",
            [
                "termination_a_type", "termination_a", "termination_b_type",
                "termination_b", "status"
            ],
        ),
        ("state", "absent", [
            "termination_a_type", "termination_a", "termination_b_type",
            "termination_b"
        ]),
    ]

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True,
                           required_if=required_if)

    cable = NautobotDcimModule(module, NB_CABLES)
    cable.run()
Beispiel #23
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NAUTOBOT_ARG_SPEC)
    argument_spec.update(
        dict(
            device_type=dict(required=True, type="raw"),
            name=dict(required=True, type="str"),
            type=dict(
                required=False,
                choices=[
                    "iec-60320-c5",
                    "iec-60320-c7",
                    "iec-60320-c13",
                    "iec-60320-c15",
                    "iec-60320-c19",
                    "iec-60309-p-n-e-4h",
                    "iec-60309-p-n-e-6h",
                    "iec-60309-p-n-e-9h",
                    "iec-60309-2p-e-4h",
                    "iec-60309-2p-e-6h",
                    "iec-60309-2p-e-9h",
                    "iec-60309-3p-e-4h",
                    "iec-60309-3p-e-6h",
                    "iec-60309-3p-e-9h",
                    "iec-60309-3p-n-e-4h",
                    "iec-60309-3p-n-e-6h",
                    "iec-60309-3p-n-e-9h",
                    "nema-5-15r",
                    "nema-5-20r",
                    "nema-5-30r",
                    "nema-5-50r",
                    "nema-6-15r",
                    "nema-6-20r",
                    "nema-6-30r",
                    "nema-6-50r",
                    "nema-l5-15r",
                    "nema-l5-20r",
                    "nema-l5-30r",
                    "nema-l5-50r",
                    "nema-l6-20r",
                    "nema-l6-30r",
                    "nema-l6-50r",
                    "nema-l14-20r",
                    "nema-l14-30r",
                    "nema-l21-20r",
                    "nema-l21-30r",
                    "CS6360C",
                    "CS6364C",
                    "CS8164C",
                    "CS8264C",
                    "CS8364C",
                    "CS8464C",
                    "ita-e",
                    "ita-f",
                    "ita-g",
                    "ita-h",
                    "ita-i",
                    "ita-j",
                    "ita-k",
                    "ita-l",
                    "ita-m",
                    "ita-n",
                    "ita-o",
                    "hdot-cx",
                ],
                type="str",
            ),
            power_port_template=dict(required=False, type="raw"),
            feed_leg=dict(required=False, choices=["A", "B", "C"], type="str"),
        ))

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    power_outlet_template = NautobotDcimModule(module,
                                               NB_POWER_OUTLET_TEMPLATES)
    power_outlet_template.run()