# AWX17.1.0 - Create inventory with multiple hosts in single shot

**URL:** <https://forum.ansible.com/t/awx17-1-0-create-inventory-with-multiple-hosts-in-single-shot/37596>\
**Category:** AWX Project\
**Tags:** awx-project, ubuntu, awx\
**Created:** [January 31, 2023, 5:11am UTC](https://forum.ansible.com/t/awx17-1-0-create-inventory-with-multiple-hosts-in-single-shot/37596 "2023-01-31T05:11:16Z")\
**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:** [January 31, 2023, 5:11am UTC](https://forum.ansible.com/t/awx17-1-0-create-inventory-with-multiple-hosts-in-single-shot/37596/1 "2023-01-31T05:11:16Z")

</div>

Hi,  
I am using AWX 17.1.0 installed on Ubuntu server. I need to create the host inventory file which has more than 25 host entries in a single shot. How to create those server lists in the inventory file? Any suggestions on this?

---

<div class="post-metadata">

**Author:** ![Raymond\_Val](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/raymond_val/32/3101_2.png) [@Raymond\_Val](https://forum.ansible.com/u/Raymond_Val)\
**Post date:** [January 31, 2023, 3:00pm UTC](https://forum.ansible.com/t/awx17-1-0-create-inventory-with-multiple-hosts-in-single-shot/37596/2 "2023-01-31T15:00:11Z")

</div>

My understanding is you want to create a Inventory with host entries without having to enter each host individually.  
The easiest way I have found is using the awx-manage command from the CLI.

1. First create your inventory in AWX, giving it a name without spaces or special characters in the name. Once the hosts are loaded you can change the name if needed.  
For my example below my inventory name is “inventory1”

2. Log into the AWX Host or AWX’s task container with a userid that has the ability to make changes to awx (usually either the awx user or any root type user).

[root@awx awx]#

1. Create a file with the list of hosts to be added to the inventory. You can use hostnames or ip addresses.  
You can also include host variables similar to an ansible hosts file.  
[root@awx awx]# cat hosts\_add  
192.168.3.151

192.168.3.152  
192.168.3.153  
192.168.3.154  
192.168.3.155  
[webserver.example.com](http://webserver.example.com) ansible\_user=myuser  
[root@awx awx]#

1. Once your list is ready, using the awx-manage command to add the hosts to the inventory you created above.  
[root@awx awx]# awx-manage inventory\_import --inventory-name inventory1 --source hosts\_add  
13.320 INFO Updating inventory 1: inventory1  
13.965 INFO Reading Ansible inventory source: /var/lib/awx/hosts\_add  
…  
22.581 INFO Inventory import completed for ( inventory1 - 6) in 10.2s  
[root@awx awx]#

2. Go back to AWX’s GUI to verify your work.

- Ray

---

<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:** [February 1, 2023, 7:26pm UTC](https://forum.ansible.com/t/awx17-1-0-create-inventory-with-multiple-hosts-in-single-shot/37596/3 "2023-02-01T19:26:10Z")

</div>

I’ll mention there is a feature in the works that will allow you to add multiple hosts to an inventory in a single request, you can follow the work here [https://github.com/ansible/awx/pull/13462](https://github.com/ansible/awx/pull/13462)

Once this lands, you can upgrade to the newest AWX to start using that feature!

AWX Team

---

<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:** [February 5, 2023, 6:07am UTC](https://forum.ansible.com/t/awx17-1-0-create-inventory-with-multiple-hosts-in-single-shot/37596/4 "2023-02-05T06:07:57Z")

</div>

Thanks for this info.  
I have awx 17.1.0 installed on Ubuntu. Here I could not see the awx-manage utility. How to get that?  
please suggest.

---

<div class="post-metadata">

**Author:** ![Raymond\_Val](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/raymond_val/32/3101_2.png) [@Raymond\_Val](https://forum.ansible.com/u/Raymond_Val)\
**Post date:** [February 6, 2023, 4:17pm UTC](https://forum.ansible.com/t/awx17-1-0-create-inventory-with-multiple-hosts-in-single-shot/37596/5 "2023-02-06T16:17:47Z")

</div>

My awx-manage is installed in /usr/bin/awx-manage  
You should be able to use the apt-file search in Ubuntu to find out where it can be installed from.  
We are using Enterprise Linux so my packages are different but I did not have to install anything extra to get awx-manage.

Ray
