peteeckel / netbox-plugin-dns

NetBox DNS is a NetBox plugin for managing DNS data.
https://pypi.org/project/netbox-plugin-dns
MIT License
195 stars 17 forks source link

Added functionality to add IP address filters to DNS views for IPAM DNSsync #407

Closed peteeckel closed 3 weeks ago

peteeckel commented 3 weeks ago

fixes #401

This PR contains an enhancement to IPAM DNSsync.

It is now possible to add filters to DNS views that specify which IP addresses DNS address records should be created for. One use case is to provide a mechanism to only add specifically selected IP addresses to an external view used for queries from the internet, while all addresses get DNS records in the internal DNS view.

The syntax is essentially the same as for NetBox object permissions. For example this filter only selects IP addresses with a DNS Name starting with external- for DNS record creation:

{
    "dns_name__startswith": "external-"
}

Probably more practically, a custom field named external could be created for IPAddress objects and the external zone gets the following filter:

{
    "custom_field_data__external": true
}

If multiple terms are added to the JSON dictionary, the conditions will be combined by and. It is also possible to specify an array of dictionaries, which will result in the conditions specified by the dictionaries to be combined by or. That way it is possible to specify complex conditions for address record creation.