Assign a particular hostname to cloud machine

When juju starts a machine (via add-machine), a hostname is typically generated for it. Is there a way to specify a particular hostname or even a range or name pattern from which a hostname could be selected? Specifying a particular address or an address range might also be an option.

Manual provisioning allows for this (in its way) and the MAAS provider allows a particular host to be acquired by name. But there does not seem to be a general way to do this.

If there is an actual general solution that would be great. If not, is there somewhere in the juju code someone might point me to where the name generation is being done.

1 Like

So, @jamesbeedy and @heitor would be able to let you know details also.

Since Slurm is using patterns of hostnames to form up “groups” of similar hosts with similar features, without the capability to specify hostnames, it would be difficult to “mimic” behaviors of clouds where this is possible.

This is the bundle that would be affected: Deploy Omnivector Slurm Distribution using Charmhub - The Open Operator Collection

I’ve never explored this myself, but it is a question I also have.

It would be great if we could specify the hostnames (or a pattern and then Juju adds the suffix with the number, e.g. if the pattern is db then juju creates db-1, db-2, and so on).

On what basis would this hostnaming be applied: model, application, deploy? E.g., for a model, a pattern would be specified and apply to pretty well every deployed machine of that model? Or something associated with an application? Or something else?

What use cases do you see this helpful with? Slurm has been raised as one. Anything else?