# Configuration of /etc/ansible/hosts

**URL:** <https://forum.ansible.com/t/configuration-of-etc-ansible-hosts/27179>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 3, 2018, 3:12pm UTC](https://forum.ansible.com/t/configuration-of-etc-ansible-hosts/27179 "2018-04-03T15:12:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Didier\_Bretin](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@Didier\_Bretin](https://forum.ansible.com/u/Didier_Bretin)\
**Post date:** [April 3, 2018, 3:12pm UTC](https://forum.ansible.com/t/configuration-of-etc-ansible-hosts/27179/1 "2018-04-03T15:12:25Z")

</div>

Hello,

I would like to define a SSH private key by host in /etc/ansible/hosts of my « awxcontainer\_awx\_task\_1 » docker container.  
If I login in this container and try to use the hosts defined in the ansible configuration it works.

But if I use the same playbook in AWX it’s not working. It can’t find the host definition in /etc/ansible/hosts.

Is it a bug or it’s not working like that ?

PS : I know I can defined hosts directly in AWX ;).

---

<div class="post-metadata">

**Author:** ![Chris\_Church](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@Chris\_Church](https://forum.ansible.com/u/Chris_Church)\
**Post date:** [April 3, 2018, 4:15pm UTC](https://forum.ansible.com/t/configuration-of-etc-ansible-hosts/27179/2 "2018-04-03T16:15:56Z")

</div>

AWX will always use the hosts defined in its inventory when running playbooks, and never /etc/ansible/hosts.

You can define those private keys in your inventory if you’re importing inventory from a project, or in host\_vars/host.yml files alongside your playbook. I’d highly recommend using vault in both cases; the inventory approach may depend on [https://github.com/ansible/awx/issues/223](https://github.com/ansible/awx/issues/223) being implemented, the second should work by providing a vault credential in your job template.
