-
Didn't want to open a new issue because this is help wanted question. ip_addresses:
- address: 172.30.10.5/32
assigned_object:
device: pve01
name: eth0
dns_name: pve01.mgmt.mine.xxx
custom_fields:
ipaddress_dns_record_name: pve01
ipaddress_dns_zone_id:
name: mgmt.mine.xxx but when i use netbox ip_address module i always get an error. This is my task - name: Assign IP Addresses
netbox.netbox.netbox_ip_address:
netbox_url: "{{ vault_netbox_api }}"
netbox_token: "{{ vault_netbox_token }}"
data: "{{ ip }}"
state: present
loop: "{{ ip_addresses }}"
loop_control:
loop_var: "ip"
label: "{{ ip.assigned_object.device }} - {{ ip.assigned_object.name }} => {{ ip.address }}" But i get always this error:
I do not understand how i should express the dns_zone_id field. ip_addresses:
- address: 172.30.10.5/32
assigned_object:
device: pve01
name: eth0
dns_name: pve01.mgmt.mine.xxx
custom_fields:
ipaddress_dns_record_name: pve01
ipaddress_dns_zone_id:
- name: mgmt.mine.xxx i get
Is it only allowed to have numerical id? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
I'm afraid that's a limitation of custom fields in NetBox. A NetBox custom field referencing an object expects that object's So you would need to pull a list of NetBox DNS zones in Ansible at the beginning of the code section and store that list (or dictionary, keyed by |
Beta Was this translation helpful? Give feedback.
-
Hi @shakin89, I hope you don't mind that I moved this to Discussions, it's really not something I can 'fix' or implement as a new feature. Custom Fields aren'r real model fields in NetBox, and the serializers for custom fields are somewhat limited. So, for example, it is not possible to refer to an object type custom field the way it is for other fields - this would require filtersets specific to the type of the object a custom field points to ( For the special case of NetBox DNS zones it's even worse: I see that you are trying to link an IP address to a NetBox DNS zone and at the same time set its DNS name: That isn't necessary, the current implementation of the IPAM Coupling feature sets the And this leads to something completely different: The current implementation of the IPAM Coupling feature is labelled 'experimental' for good reason. It will definitely change, probably this year if I can spare the time. The new implementation will work differently and have a few less drawbacks (for example you can only assign exactly one DNS address record to an IP address, which is a major pain when you are using views for split zone DNS), and as you just noticed the assignment of zone IDs to IP addresses comes at a price and is sometimes cumbersome. The planned (but don't hold your breath!) new functionality will work the other way around: You enter a It will also solve an issue that is currently a major pain in the backside. Let's assume you have zones So while I'm not really able to help you right now, at least I wanted to give you a perspective for a later release that will hopefully hurt less. Coupling of IP addresses to DNS address records will never be trivial, but it can be improved and it most certainly will. |
Beta Was this translation helpful? Give feedback.
-
Hi @peteeckel, first of all thank you for your work and for your detailed explanation. Let me explain my situation. I'm trying to reorder all my setup (a big mess) for my house/homelab, so there is not a real big issue if i have to change something.
Well yes, that's just my intent. I want to setup an IP Address, i want to link it to a dns name, then i will pull this info to create a Bind DNS zone. When i add a device i will recreate the zone and inform bind to reload it.
You just helped me a lot, thank you. Now i can go on with my project and when ipam coupling will change it's behaviour i will adapt my infrastructure. Thanks in advance |
Beta Was this translation helpful? Give feedback.
-
FYI: I've opened an FR with the NetBox core project, let's see what comes out of it. netbox-community/netbox#15797 |
Beta Was this translation helpful? Give feedback.
Hi @shakin89, I hope you don't mind that I moved this to Discussions, it's really not something I can 'fix' or implement as a new feature.
Custom Fields aren'r real model fields in NetBox, and the serializers for custom fields are somewhat limited. So, for example, it is not possible to refer to an object type custom field the way it is for other fields - this would require filtersets specific to the type of the object a custom field points to (
name
is not always a primary key, so NetBox needs to know what it can use to uniquely address an object), among other things. That's the reason for the error you are seeing.For the special case of NetBox DNS zones it's even worse:
name
does not un…