コード例 #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"),
                parent_tenant_group=dict(required=False, type="str"),
                description=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_tenant_group = NetboxTenancyModule(module, NB_TENANT_GROUPS)
    netbox_tenant_group.run()
コード例 #2
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"),
                tenant_group=dict(required=False, type="raw"),
                description=dict(required=False, type="str"),
                comments=dict(required=False, type="str"),
                slug=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_tenant = NetboxTenancyModule(module, NB_TENANTS)
    netbox_tenant.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(
                name=dict(required=True, type="str"),
                title=dict(required=False, type="str"),
                phone=dict(required=False, type="str"),
                email=dict(required=False, type="str"),
                address=dict(required=False, type="str"),
                comments=dict(required=False, type="str"),
                contact_group=dict(required=False, type="raw"),
                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_contact = NetboxTenancyModule(module, NB_CONTACTS)
    netbox_contact.run()