Problem:
Host groups do not work as expected.
Let’s assume that I have 2 organizations:
- OrganizationA
- OrganizationB
Plus 2 Locations:
- France
- USA
Now I would like to create a host group called “WORKSTATIONS” which will be applied to 2 separate organizations and locations.
I am NOT allowed to do that. I would like to have “Workstations” host group added to each location, e.g.:
OrganizationA\USA\Workstations
OrganizationB\France\Workstations
And it doesn’t work - ‘name has already been taken’ error is generated.
Even though Location and Organization do NOT matter here as I can’t even add host group under the same name to 2 separate organizations. For some reason “Host Groups” are global which totally doesn’t make sense because when you view the host groups in the Configure/Host Groups tab, they are NOT global, e.g.
When I select OrganizationA & France I can see host groups which were added ONLY to that Org & Location.
Likewise, when I select OrganizationB & USA I can see host groups which were added ONLY to that Org & Location… or rather I can see empty list because I couldn’t add “Workstation” host group.
It is the same with the Foreman API. Proof:
No of host groups added to the location ‘26’
/api/locations/26/hostgroups
{
"total": 0,
"subtotal": 0,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": []
}
Location 25 has many host groups added:
/api/locations/25/hostgroups
{
"total": 1688,
"subtotal": 1688,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order":
...
Trying to add a new host group using POST call:
{
"location_id": 26,
"hostgroup": {
"name": "Workstations"
},
"organization_id": 5
}
Result:
{
"error": {
"id": null,
"errors": {
"name": [
"has already been taken"
]
},
"full_messages": [
"Name has already been taken"
]
}
}
I even tried with:
{
"hostgroup": {
"name": "Workstations",
"location_ids": [26],
"organization_ids": [5]
}
}
and result is the same.
Expected outcome:
I would like to create host group under the same name for different organizations and locations.
Foreman and Proxy versions:
3.8
Distribution and version:
Ubuntu 20.04