Exemplo n.º 1
0
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),
    )

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

    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_manufacturer = NetboxDcimModule(module, NB_MANUFACTURERS)
    netbox_manufacturer.run()
Exemplo n.º 3
0
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),
    )

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

    # Fail if device name is not given
    if not module.params["data"].get("name"):
        module.fail_json(msg="missing device name")

    netbox_device = NetboxDcimModule(module, NB_DEVICES)
    netbox_device.run()