Uci change static lease - and deploy static leases by code

I think I've worked out that if I tag my static lease entries in uci I can then change them
uci set dhcp.cloudtest="host"
Is there a way to change previous ones without these tags?
And also can I change the tag name itself please?

This may be an XY problem... really I'm looking into deploying machines on proxmox by code, terraform and ansible, and it would be good to be able to setup openwrt leases as part of that.
I'm looking at the various ansible scripts plugins but if anyone has any suggestions please shout

Many thanks for looking

1 Like
uci show dhcp
uci set dhcp.@host[3].ip="192.168.1.2"
uci rename dhcp.@host[1]="pc1"
uci commit dhcp

https://github.com/gekmihesg/ansible-openwrt

1 Like

Perfect thank you!

Is there an uci way to choose the host number WHERE ip=

No problem if not, I'll script

1 Like

You can fetch persistent or runtime network parameters like this:
https://openwrt.org/docs/guide-developer/network-scripting#get_wan_address

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.