Host groups in multi-site deployments

I am looking at improving the host groups usability in multi-site deployments of foreman.
Currently when defining a host group it is possible to set default network domain and subnet and default os media path.
All three can be location and organization dependent in a multi-site environment.

I was looking for a solution that will make it possible to model some multi-site use cases without complicating the solution for others.
Use case A, Domain selection depend on location and organization:
Any server in acme corp uses domain
TLV site uses
Engineering group in TLV uses

Use case B, Subnet depend on deployment rack:
Each data center get it's set of subnets
Each rack in the data center gets a specific subnet.

Use case C, Provisioning media path is site specific.

In order not to break existing implementations and to keep supporting the option to turn off locations and organizations in settings,
I suggest adding an option in the drop down of each of the location dependent fields, that says 'Auto resolve'.
This option will be added only when locations or organizations are enabled, and previously created host group will continue to work as
expected because this is a new option.

When provisioning a host after selecting location, organization and a hostgroup, the hostgroup auto resolve fields should be calculated.

Let's go back to use case A and review the new solution,
in ACME corp, location is TLV organization is engineering, and the domain is set in the host group to auto resolve.

TLV location has the following domains enabled:,,
Engineering organization has many eng.* domains.
Selecting both Engineering and TLV result in a single domain.

Voala we have a solution!
Only problem I see is that it is going to be difficult to maintain lists of domains, subnets and provisioning media for each organization and location.
I further suggest adding location and organization hierarchy to enable a model where a rack that is inheriting from a site or a data center,
the rack will be able to define specific subnet and inherit provisioning media of the data center or site.

Comments are welcome,