# Create new host

**URL:** <https://forum.ansible.com/t/create-new-host/35296>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [June 7, 2021, 11:04am UTC](https://forum.ansible.com/t/create-new-host/35296 "2021-06-07T11:04:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 7, 2021, 11:04am UTC](https://forum.ansible.com/t/create-new-host/35296/1 "2021-06-07T11:04:23Z")

</div>

Hi,

I am trying create a new host in AWX and assign it to a specific inventory as part of my VM provisioning but I cant seem to get it to work.

Anyone point me in the right direction?

Cheers

---

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 7, 2021, 11:05am UTC](https://forum.ansible.com/t/create-new-host/35296/2 "2021-06-07T11:05:45Z")

</div>

Just to add, I am not wanting to use an inventory source, I merely want to create a new host to AWX when the VM is provisioned

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [June 7, 2021, 8:34pm UTC](https://forum.ansible.com/t/create-new-host/35296/3 "2021-06-07T20:34:07Z")

</div>

Use this?  
[https://docs.ansible.com/ansible/latest/collections/awx/awx/tower\_host\_module.html](https://docs.ansible.com/ansible/latest/collections/awx/awx/tower_host_module.html)

---

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 9, 2021, 12:45pm UTC](https://forum.ansible.com/t/create-new-host/35296/4 "2021-06-09T12:45:14Z")

</div>

Hey

Yes I used that tower\_host module but I get an error:

msg": “Failed to update host: There was a network error of some kind trying to connect to Tower.\n\nThe most common reason for this is a settings issue; is your "host" value in `tower-cli config` correct?\nRight now it is: "[hostname.domain.com](http://panel.topgunmatrix.com/)".”}

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [June 9, 2021, 12:47pm UTC](https://forum.ansible.com/t/create-new-host/35296/5 "2021-06-09T12:47:19Z")

</div>

That sounds like your host in the configuration is not set correctly. Have you tried to authenticate first?

---

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 9, 2021, 12:50pm UTC](https://forum.ansible.com/t/create-new-host/35296/6 "2021-06-09T12:50:31Z")

</div>

I can add the host manually and everything works fine.

Can you expand on what you mean authenticate first please?

Thank you

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [June 9, 2021, 12:53pm UTC](https://forum.ansible.com/t/create-new-host/35296/7 "2021-06-09T12:53:01Z")

</div>

When you use tower\_host there is an option to put in username and password or config file details. Did you supply that?  
[https://docs.ansible.com/ansible/latest/collections/awx/awx/tower\_host\_module.html](https://docs.ansible.com/ansible/latest/collections/awx/awx/tower_host_module.html)

---

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 9, 2021, 1:03pm UTC](https://forum.ansible.com/t/create-new-host/35296/8 "2021-06-09T13:03:15Z")

</div>

yes, here is my playbook

- name: Add new host to organisations inventory  
delegate\_to: localhost  
tower\_host:  
name: hostname\_to\_add  
description: generic description  
inventory: inventory\_name  
state: present

tower\_username: username  
tower\_password password

validate\_certs: yes

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [June 9, 2021, 1:12pm UTC](https://forum.ansible.com/t/create-new-host/35296/9 "2021-06-09T13:12:43Z")

</div>

Set the tower host name. You have not supplied that in the playbook.

Where is this parameter tower\_host set in your playbook? That’s what it is complaining about.

---

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 9, 2021, 2:37pm UTC](https://forum.ansible.com/t/create-new-host/35296/10 "2021-06-09T14:37:24Z")

</div>

Cheers, I did have that included but there was a typo, thanks for pointing that out.

All working now!
