Beispiel #1
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(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"),
                tags=dict(required=False, type="list", elements="raw"),
                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_group = NetboxVirtualizationModule(module, NB_CLUSTER_GROUP)
    netbox_cluster_group.run()
Beispiel #2
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(NETBOX_ARG_SPEC)
    argument_spec.update(
        dict(data=dict(
            type="dict",
            required=True,
            options=dict(
                virtual_machine=dict(required=False, type="raw"),
                name=dict(required=True, type="str"),
                enabled=dict(required=False, type="bool"),
                mtu=dict(required=False, type="int"),
                mac_address=dict(required=False, type="str"),
                description=dict(required=False, type="str"),
                mode=dict(required=False, type="raw"),
                parent_vm_interface=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"),
            ),
        ), ))

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

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

    netbox_vm_interface = NetboxVirtualizationModule(module, NB_VM_INTERFACES)
    netbox_vm_interface.run()
Beispiel #3
0
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()
Beispiel #4
0
def main():
    """
    Main entry point for module execution
    """
    argument_spec = deepcopy(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="float"),
                    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"),
                    status=dict(required=False, type="raw"),
                    tags=dict(required=False, type="list", elements="raw"),
                    custom_fields=dict(required=False, type="dict"),
                    local_context_data=dict(required=False, type="dict"),
                    comments=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_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(
                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_cluster_type = NetboxVirtualizationModule(module, NB_CLUSTER_TYPE)
    netbox_cluster_type.run()