Пример #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"),
                color=dict(required=False, type="str"),
                description=dict(required=False, 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_tag = NetboxExtrasModule(module, NB_TAGS)
    netbox_tag.run()
Пример #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(
                    content_type=dict(required=False, type="raw"),
                    name=dict(required=True, type="str"),
                    description=dict(required=False, type="str"),
                    template_code=dict(required=True, type="raw"),
                    mime_type=dict(required=False, type="str"),
                    file_extension=dict(required=False, type="str"),
                    as_attachment=dict(required=False, type="bool"),
                ),
            )
        )
    )

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

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

    netbox_export_template = NetboxExtrasModule(module, NB_EXPORT_TEMPLATES)
    netbox_export_template.run()
Пример #3
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(
                content_type=dict(required=False, type="raw"),
                name=dict(required=True, type="str"),
                link_text=dict(required=True, type="raw"),
                link_url=dict(required=True, type="raw"),
                weight=dict(required=False, type="int"),
                group_name=dict(required=False, type="str"),
                button_class=dict(required=False, type="raw"),
                new_window=dict(required=False, type="bool"),
            ),
        )))

    required_if = [
        ("state", "present", ["content_type", "name", "link_text",
                              "link_url"]),
        ("state", "absent", ["name"]),
    ]

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

    netbox_custom_link = NetboxExtrasModule(module, NB_CUSTOM_LINKS)
    netbox_custom_link.run()
Пример #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"),
                weight=dict(required=False, type="int"),
                description=dict(required=False, type="str"),
                is_active=dict(required=False, type="bool"),
                regions=dict(required=False, type="list", elements="str"),
                sites=dict(required=False, type="list", elements="str"),
                roles=dict(required=False, type="list", elements="str"),
                device_types=dict(required=False, type="list", elements="str"),
                platforms=dict(required=False, type="list", elements="str"),
                cluster_groups=dict(
                    required=False, type="list", elements="str"),
                clusters=dict(required=False, type="list", elements="str"),
                tenant_groups=dict(required=False, type="list",
                                   elements="str"),
                tenants=dict(required=False, type="list", elements="str"),
                tags=dict(required=False, type="list", elements="str"),
                data=dict(required=False, type="dict"),
            ),
        )))

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

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

    netbox_config_context = NetboxExtrasModule(module, NB_CONFIG_CONTEXTS)
    netbox_config_context.run()
Пример #5
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(
                content_types=dict(required=False, type="list",
                                   elements="raw"),
                name=dict(required=True, type="str"),
                type_create=dict(required=False, type="bool"),
                type_update=dict(required=False, type="bool"),
                type_delete=dict(required=False, type="bool"),
                payload_url=dict(required=False, type="str"),
                enabled=dict(required=False, type="bool"),
                http_method=dict(required=False, type="raw"),
                http_content_type=dict(required=False, type="str"),
                additional_headers=dict(required=False, type="str"),
                body_template=dict(required=False, type="str"),
                secret=dict(required=False, type="str", no_log=False),
                conditions=dict(required=False, type="str"),
                ssl_verification=dict(required=False, type="bool"),
                ca_file_path=dict(required=False, type="str"),
            ),
        )))

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

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

    netbox_webhook = NetboxExtrasModule(module, NB_WEBHOOKS)
    netbox_webhook.run()
Пример #6
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(
                content_types=dict(required=False, type="list",
                                   elements="raw"),
                type=dict(required=False, type="raw"),
                name=dict(required=True, type="str"),
                label=dict(required=False, type="str"),
                description=dict(required=False, type="str"),
                required=dict(required=False, type="bool"),
                filter_logic=dict(required=False, type="raw"),
                default=dict(required=False, type="raw"),
                weight=dict(required=False, type="int"),
                validation_minimum=dict(required=False, type="int"),
                validation_maximum=dict(required=False, type="int"),
                validation_regex=dict(required=False, type="str"),
                choices=dict(required=False, type="list", elements="str"),
            ),
        )))

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

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

    netbox_custom_field = NetboxExtrasModule(module, NB_CUSTOM_FIELDS)
    netbox_custom_field.run()