mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 03:47:36 -02:30
create new bulk host create endpoint
allow system admins, org admins, and inventory admins to bulk create hosts. Testing on an "open" licensed awx as system admin, I created 1000 hosts with 6 queries in ~ 0.15 seconds Testing on an "open" licensed awx as organization admin, I created 1000 hosts with 11 queries in ~ 0.15 seconds fix org max host check also only do permission denied if license is a trial add /api/v2/bulk to list bulk apis available add api description templates One motiviation to not take a list of hosts with mixed inventories is to keep things simple re: RBAC and keeping a constant number of queries. If there is great clamor for accepting list of hosts to insert into arbitrary different inventories, we could probably make it happen - we'd need to pop the inventory off of each of the hosts, run the HostSerializer validate, then in top level BulkHostCreateSerializer fetch all the inventories/check permissions/org host limits for those inventories/etc. But that makes this that much more complicated. add test for rbac access test also helped me find a bug in a query, fixed that add test to assert num queries scales as expected also move other test to dedicated file also test with super user like I meant to record activity stream for the inventory this records that a certain number of hosts were added by a certain user we could consider if there is any other additional information we want to include
This commit is contained in:
16
awx/api/templates/api/bulk_host_create_view.md
Normal file
16
awx/api/templates/api/bulk_host_create_view.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Bulk Host Create
|
||||
|
||||
This endpoint allows the client to create multiple hosts and associate them with an inventory. They may do this by providing the inventory ID and a list of json that would normally be provided to create hosts.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
{
|
||||
"inventory": 1,
|
||||
"hosts": [
|
||||
{"name": "example1.com"},
|
||||
{"name": "example2.com"}
|
||||
]
|
||||
|
||||
}
|
||||
```
|
||||
3
awx/api/templates/api/bulk_view.md
Normal file
3
awx/api/templates/api/bulk_view.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Bulk Actions
|
||||
|
||||
This endpoint lists available bulk action APIs.
|
||||
Reference in New Issue
Block a user