# Create more hosts in one group using API

**URL:** <https://forum.ansible.com/t/create-more-hosts-in-one-group-using-api/37773>\
**Category:** AWX Project\
**Tags:** awx-project, ubuntu, awx\
**Created:** [March 15, 2023, 5:36pm UTC](https://forum.ansible.com/t/create-more-hosts-in-one-group-using-api/37773 "2023-03-15T17:36:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saravanan\_jothilinga](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@saravanan\_jothilinga](https://forum.ansible.com/u/saravanan_jothilinga)\
**Post date:** [March 15, 2023, 5:36pm UTC](https://forum.ansible.com/t/create-more-hosts-in-one-group-using-api/37773/1 "2023-03-15T17:36:50Z")

</div>

Hi All,  
We have an AWX instance hosted on Ubuntu. We don’t have access to the server and just the AWX UI access. Here I need to create an inventory with groups having more than 100+ servers. In the UI, using ‘add newhost’ options is taking a long time to add server by server. Are there any API which will add those 100+ under one group. Could you please throw some light on this.

Note - We don’t have access to AWX server to run awx-manage cli cmd to create the multiple servers in the inv file.

Thanks  
Saravanan

---

<div class="post-metadata">

**Author:** ![saravanan\_jothilinga](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@saravanan\_jothilinga](https://forum.ansible.com/u/saravanan_jothilinga)\
**Post date:** [March 16, 2023, 1:59pm UTC](https://forum.ansible.com/t/create-more-hosts-in-one-group-using-api/37773/2 "2023-03-16T13:59:21Z")

</div>

Any update on this?

---

<div class="post-metadata">

**Author:** ![Boardy404](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@Boardy404](https://forum.ansible.com/u/Boardy404)\
**Post date:** [March 16, 2023, 2:37pm UTC](https://forum.ansible.com/t/create-more-hosts-in-one-group-using-api/37773/3 "2023-03-16T14:37:15Z")

</div>

Without knowing how you are hosting the servers it is hard to give a specific solution. Have you checked out some of the built in functionality for creating dynamic inventories? Maybe start here [https://docs.ansible.com/ansible-tower/latest/html/administration/scm-inv-source.html#inventory-file-importing](https://docs.ansible.com/ansible-tower/latest/html/administration/scm-inv-source.html#inventory-file-importing). There are also inventory plugins that can do the heavy lifting for you too.

---

<div class="post-metadata">

**Author:** ![mjksohonet](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mjksohonet/32/1217_2.png) [@mjksohonet](https://forum.ansible.com/u/mjksohonet)\
**Post date:** [March 16, 2023, 3:59pm UTC](https://forum.ansible.com/t/create-more-hosts-in-one-group-using-api/37773/4 "2023-03-16T15:59:07Z")

</div>

Assuming that you have your playbooks in a git repository somewhere, then, what you can do is use the repository to store your inventory file(s).

To access the file(s) do the following.  
Create a new inventory and save it.  
Click the Sources tab and click the Add button.  
Give it a name and for Source, select ‘Sourced from a Project’.  
In the extra fields that appear, select the Project you are using and in the filename field enter a name which is relative to the project root in the repository.  
All you need to do now is find a way to populate that file with the data you want.  
Once you have data in the file, you can modify the template to use the new inventory.

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [March 17, 2023, 5:44pm UTC](https://forum.ansible.com/t/create-more-hosts-in-one-group-using-api/37773/5 "2023-03-17T17:44:45Z")

</div>

using dynamic inventory is the recommended route for this use case

I’ll also mention that we just added a Bulk Host create endpoint, which should land in the next AWX release [https://github.com/ansible/awx/pull/13462](https://github.com/ansible/awx/pull/13462)

This will allow you to efficiently add many hosts to a single inventory in one API call

AWX Team
