def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=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"], ), # Will uncomment other status dict once slugs are the only option (Netbox 2.8) status=dict(required=False, type="raw"), # status=dict( # required=False, # choices=[ # "Active", # "Offline", # "Planned", # "Staged", # "Failed", # "Inventory", # ], # ), primary_ip4=dict(required=False, type="raw"), primary_ip6=dict(required=False, type="raw"), cluster=dict(required=False, type="raw"), comments=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), )) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) if module.params["data"]["name"] == "": module.params["data"]["name"] = str(uuid.uuid4()) netbox_device = NetboxDcimModule(module, NB_DEVICES) netbox_device.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( device=dict(required=False, 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"), tags=dict(required=False, type=list), ), ), )) required_if = [ ("state", "present", ["device", "name"]), ("state", "absent", ["device", "name"]), ] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_inventory_item = NetboxDcimModule(module, NB_INVENTORY_ITEMS) netbox_inventory_item.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( manufacturer=dict(required=False, type="raw"), model=dict(required=False, type="raw"), slug=dict(required=True, 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"]), comments=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), )) required_if = [("state", "present", ["slug"]), ("state", "absent", ["slug"])] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_device_type = NetboxDcimModule(module, NB_DEVICE_TYPES) netbox_device_type.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( prefix=dict(required=True, type="raw"), rir=dict(required=False, type="raw"), date_added=dict(required=False, type="str"), description=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), )) required_if = [("state", "present", ["prefix"]), ("state", "absent", ["prefix"])] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_aggregate = NetboxIpamModule(module, NB_AGGREGATES) netbox_aggregate.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), slug=dict(required=False, type="str"), ), ), ) ) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_manufacturer = NetboxDcimModule(module, NB_MANUFACTURERS) netbox_manufacturer.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( device=dict(required=True, type="raw"), virtual_machine=dict(required=False, type="raw"), name=dict(required=True, type="str"), port=dict(required=True, type="int"), protocol=dict(required=True, type="raw"), ipaddresses=dict(required=False, type="raw"), description=dict(required=False, type="str"), custom_fields=dict(required=False, type=dict), ), ), ) ) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_service = NetboxIpamModule(module, NB_SERVICES) netbox_service.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( circuit=dict(required=True, type="raw"), term_side=dict(required=True, choices=["A", "Z"]), site=dict(required=False, type="raw"), port_speed=dict(required=False, type="int"), upstream_speed=dict(required=False, type="int"), xconnect_id=dict(required=False, type="str"), pp_info=dict(required=False, type="str"), description=dict(required=False, type="str"), ), ), )) required_if = [ ("state", "present", ["circuit", "term_side"]), ("state", "absent", ["circuit", "term_side"]), ] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_circuit_termination = NetboxCircuitsModule(module, NB_CIRCUIT_TERMINATIONS) netbox_circuit_termination.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), slug=dict(required=False, type="str"), site=dict(required=False, type="raw"), ), ), )) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_vlan_group = NetboxIpamModule(module, NB_VLAN_GROUPS) netbox_vlan_group.run()
def main(): """ Main entry point for module execution """ argument_spec = dict( netbox_url=dict(type="str", required=True), netbox_token=dict(type="str", required=True, no_log=True), data=dict(type="dict", required=True), state=dict( required=False, default="present", choices=["present", "absent", "new"] ), validate_certs=dict(type="bool", default=True), ) required_if = [ ("state", "present", ["address", "prefix"], True), ("state", "absent", ["address"]), ("state", "new", ["address", "prefix"], True), ] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_ip_address = NetboxIpamModule(module, NB_IP_ADDRESSES) netbox_ip_address.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), cluster_type=dict(required=False, type="raw"), cluster_group=dict(required=False, type="raw"), site=dict(required=False, type="raw"), comments=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), ) ) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_cluster = NetboxVirtualizationModule(module, NB_CLUSTERS) netbox_cluster.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), color=dict(required=False, type="str"), slug=dict(required=False, type="str"), vm_role=dict(required=False, type="bool"), ), ), )) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_device_role = NetboxDcimModule(module, NB_DEVICE_ROLES) netbox_device_role.run()
def main(): """ Main entry point for module execution """ argument_spec = dict( netbox_url=dict(type="str", required=True), netbox_token=dict(type="str", required=True, no_log=True), data=dict(type="dict", required=True), state=dict(required=False, default="present", choices=["present", "absent"]), validate_certs=dict(type="bool", default=True), ) required_if = [ ("state", "present", ["circuit", "term_side"]), ("state", "absent", ["circuit", "term_side"]), ] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_circuit_termination = NetboxCircuitsModule(module, NB_CIRCUIT_TERMINATIONS) netbox_circuit_termination.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), rd=dict(required=False, type="str"), tenant=dict(required=False, type="raw"), enforce_unique=dict(required=False, type="bool"), description=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), ) ) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_vrf = NetboxIpamModule(module, NB_VRFS) netbox_vrf.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=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), ), ), )) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_device_bay = NetboxDcimModule(module, NB_DEVICE_BAYS) netbox_device_bay.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( id=dict(required=False, type="int"), termination_a_type=dict(required=False, type="str"), termination_a_name=dict(required=True, type="str"), # device name termination_a_port=dict(required=True, type="str"), # device port termination_b_type=dict(required=False, type="str"), termination_b_name=dict(required=True, type="str"), # device name termination_b_port=dict(required=True, type="str"), # device port type=dict(required=False, type="int"), status=dict(required=False, type="bool"), label=dict(required=False, type="str"), color=dict(required=False, type="str"), length=dict(required=False, type="int"), length_unit=dict(required=False, type="raw"), ), ), )) required_if = [ ( "state", "present", [ "termination_a_name", "termination_a_port", "termination_b_name", "termination_b_port", ], ), ("state", "absent", ["id"]), ] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_cable = NetboxDcimModule(module, NB_CABLES) netbox_cable.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( family=dict(required=False, type="int"), prefix=dict(required=False, type="raw"), parent=dict(required=False, type="raw"), prefix_length=dict(required=False, type="int"), site=dict(required=False, type="str"), vrf=dict(required=False, type="raw"), tenant=dict(required=False, type="raw"), vlan=dict(required=False, type="raw"), # Will uncomment other status dict once slugs are the only option (Netbox 2.8) status=dict(required=False, type="raw"), # status=dict( # required=False, # type="str", # choices=["Active", "Container", "Deprecated", "Reserved"], # ), prefix_role=dict(required=False, type="raw"), is_pool=dict(required=False, type="bool"), description=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), first_available=dict(required=False, type="bool"), ) ) required_if = [ ("state", "present", ["prefix", "parent"], True), ("state", "absent", ["prefix"]), ("first_available", "yes", ["parent"]), ] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_prefix = NetboxIpamModule(module, NB_PREFIXES) netbox_prefix.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( cid=dict(required=True, type="str"), provider=dict(required=False, type="raw"), circuit_type=dict(required=False, type="raw"), # Will uncomment other status dict once slugs are the only option (Netbox 2.8) status=dict(required=False, type="raw"), # status=dict( # required=False, # choices=[ # "Active", # "Offline", # "Planned", # "Provisioning", # "Deprovisioning", # "Decommissioned", # ], # ), tenant=dict(required=False, type="raw"), install_date=dict(required=False, type="str"), commit_rate=dict(required=False, type="int"), description=dict(required=False, type="str"), comments=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), ) ) required_if = [("state", "present", ["cid"]), ("state", "absent", ["cid"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_circuit = NetboxCircuitsModule(module, NB_CIRCUITS) netbox_circuit.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), # Will uncomment other status dict once slugs are the only option (Netbox 2.8) status=dict(required=False, type="raw"), # status=dict( # required=False, choices=["Active", "Planned", "Retired"], # ), region=dict(required=False, type="raw"), tenant=dict(required=False, type="raw"), vlan_role=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="float"), longitude=dict(required=False, type="float"), 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"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), ) ) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_site = NetboxDcimModule(module, NB_SITES) netbox_site.run()
def main(): """ Main entry point for module execution """ argument_spec = dict( netbox_url=dict(type="str", required=True), netbox_token=dict(type="str", required=True, no_log=True), data=dict(type="dict", required=True), state=dict(required=False, default="present", choices=["present", "absent"]), validate_certs=dict(type="bool", default=True), ) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_device = NetboxDcimModule(module, NB_DEVICES) netbox_device.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( site=dict(required=False, type="raw"), vlan_group=dict(required=False, type="raw"), vid=dict(required=False, type="int"), name=dict(required=True, type="str"), tenant=dict(required=False, type="raw"), # Will uncomment other status dict once slugs are the only option (Netbox 2.8) status=dict(required=False, type="raw"), # status=dict( # required=False, choices=["Active", "Reserved", "Deprecated"], # ), vlan_role=dict(required=False, type="raw"), description=dict(required=False, type="str"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), ) ) required_if = [ ("state", "present", ["name"]), ("state", "absent", ["name"]), ] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_vlan = NetboxIpamModule(module, NB_VLANS) netbox_vlan.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), site=dict(required=False, type="raw"), cluster=dict(required=False, type="raw"), virtual_machine_role=dict(required=False, type="raw"), vcpus=dict(required=False, type="int"), tenant=dict(required=False, type="raw"), platform=dict(required=False, type="raw"), primary_ip4=dict(required=False, type="raw"), primary_ip6=dict(required=False, type="raw"), memory=dict(required=False, type="int"), disk=dict(required=False, type="int"), rack=dict(required=False, type="raw"), # Will uncomment other status dict once slugs are the only option (Netbox 2.8) status=dict(required=False, type="raw"), # status=dict(required=False, type="str", choices=["Active", "Offline", "Staged"]), tags=dict(required=False, type=list), ), ), ) ) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_virtual_machine = NetboxVirtualizationModule(module, NB_VIRTUAL_MACHINES) netbox_virtual_machine.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( device=dict(required=False, type="raw"), name=dict(required=True, type="str"), form_factor=dict(required=False, type="raw"), 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, choices=["Access", "Tagged", "Tagged All"], ), untagged_vlan=dict(required=False, type="raw"), tagged_vlans=dict(required=False, type="raw"), tags=dict(required=False, type=list), ), ), )) required_if = [ ("state", "present", ["device", "name"]), ("state", "absent", ["device", "name"]), ] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_device_interface = NetboxDcimModule(module, NB_INTERFACES) netbox_device_interface.run()
def main(): """ Main entry point for module execution """ argument_spec = dict( netbox_url=dict(type="str", required=True), netbox_token=dict(type="str", required=True, no_log=True), data=dict(type="dict", required=True), state=dict(required=False, default="present", choices=["present", "absent"]), first_available=dict(type="bool", required=False, default=False), validate_certs=dict(type="bool", default=True), ) required_if = [ ("state", "present", ["prefix", "parent"], True), ("state", "absent", ["prefix"]), ("first_available", "yes", ["parent"]), ] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_prefix = NetboxIpamModule(module, NB_PREFIXES) netbox_prefix.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC argument_spec.update( dict(data=dict( type="dict", required=True, options=dict( name=dict(required=True, type="str"), slug=dict(required=False, type="str"), ), ), )) required_if = [("state", "present", ["name"]), ("state", "absent", ["name"])] module = NetboxAnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) netbox_circuit_type = NetboxCircuitsModule(module, NB_CIRCUIT_TYPES) netbox_circuit_type.run()
def main(): """ Main entry point for module execution """ argument_spec = NETBOX_ARG_SPEC # state choices present, absent, new argument_spec["state"] = dict( required=False, default="present", choices=["present", "absent", "new"] ) argument_spec.update( dict( data=dict( type="dict", required=True, options=dict( family=dict(required=False, type="int"), address=dict(required=False, type="str"), prefix=dict(required=False, type="raw"), vrf=dict(required=False, type="raw"), tenant=dict(required=False, type="raw"), # Will uncomment other status dict once slugs are the only option (Netbox 2.8) status=dict(required=False, type="raw"), # status=dict( # required=False, # type="str", # choices=["Active", "Reserved", "Deprecated", "DHCP"], # ), role=dict( required=False, type="str", choices=[ "Loopback", "Secondary", "Anycast", "VIP", "VRRP", "HSRP", "GLBP", "CARP", ], ), interface=dict(required=False, type="raw"), description=dict(required=False, type="str"), nat_inside=dict(required=False, type="raw"), tags=dict(required=False, type=list), custom_fields=dict(required=False, type=dict), ), ), ) ) required_if = [ ("state", "present", ["address", "prefix"], True), ("state", "absent", ["address"]), ("state", "new", ["address", "prefix"], True), ] module = NetboxAnsibleModule( argument_spec=argument_spec, supports_check_mode=True, required_if=required_if ) netbox_ip_address = NetboxIpamModule(module, NB_IP_ADDRESSES) netbox_ip_address.run()