Page MenuHomePhabricator

Automation to add extra IPs to servers
Open, MediumPublic

Description

Follow up from this specific comment : https://phabricator.wikimedia.org/T346428#9418800

Which came back on the table with : https://phabricator.wikimedia.org/T354893#9551121

We need automation (cookbook, Netbox script or both) to add extra IPs (and their dns_name) to a given host.

I only see benefits :

  • Simplify the already complex provisioning process for DCops by asking one less question
  • Give autonomy to service owners to add IPs at any time when absolutely required
  • Simplify the provisioning automation code by separating this specific function from the core ones

A possible and simple implementation for the v1 could be a Netbox script with a single field Device name.

Once ran, it would take the next available IP on the primary's interface's subnet, and assign it to the same interface with a dns_name set to $device_name-$index.$suffix, where index can be a letter (or even easier, a digit), computed based on number of IPs on the interface.
The user would then need to run the dns cookbook after running the script as many times as they need.

I think that would solve any immediate usecase.

Future evolution could be to :

  • add a matching IPv6 address automatically with the option do not add IPv6
  • add a field to directly set how many new IPs to configured

If writing a cookbook, it could run the dns cookbook automatically. And either edit Netbox directly or run the cookbook.

Note that the need for such usecase might go away in the medium/long term future : https://phabricator.wikimedia.org/T269328#9437891

Any other "non standard" provisioning should probably have their dedicated automation to not clutter the generic one.

Event Timeline

ayounsi triaged this task as Medium priority.

The one at a time part is what worries me a bit, in this last case there were 9 hosts and they needed 3 IPs per host, so 18 times...
The other bit is the name, that in the specific case of cassandra must follow the existing standard ('-a', '-b', ...) to match the puppet side of things.

The one at a time part is what worries me a bit,

Doesn't seem like a hard problem to solve :)

The other bit is the name

Similarly we could pass a pattern or prefix.

Change #1017064 had a related patch set uploaded (by Cathal Mooney; author: Cathal Mooney):

[operations/software/netbox-extras@master] Netbox custom script to add additional IPv4 addresses to host

https://gerrit.wikimedia.org/r/1017064

I added the above script so we can move this outside of the current provision script, and simplify the work towards replacing that one with one which picks attributes based on the host name/profile.

I chose a Netbox script as it seemed closest to the existing way, but perhaps a cookbook would work better. I spoke briefly to @Eevans who is happy with the idea of adding them after the provision step in general. In terms of the dns names I left the convention as it was, which I think is probably fine (longer term we hope not to need these).

Netbox script is great, we can call it from a cookbook if needed later on.

Change #1017064 merged by jenkins-bot:

[operations/software/netbox-extras@master] Netbox custom script to add additional IPv4 addresses to host

https://gerrit.wikimedia.org/r/1017064