# Can't use Github Enterprise credential in inventory source

**URL:** <https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454>\
**Category:** AWX Project\
**Tags:** awx, kubernetes\
**Created:** [July 2, 2021, 5:35pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454 "2021-07-02T17:35:41Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 2, 2021, 5:35pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/1 "2021-07-02T17:35:41Z")

</div>

I have AWX 19.2.2 set up in k8s using awx-operator and trying to set up a new inventory. The inventory project is created and the Github Enterprise credential is created, and the project syncs correctly. When I create the inventory and set up the source, I have selected “Sourced from a Project” in the Source field. Then I select the appropriate project in the Project field. But in the Credential field, my GHE credential doesn’t show up, and nothing shows up in the “Inventory file” field other than “/ (project root”

I’m not sure what I’m doing wrong here, but we have been using custom inventory scripts in older versions of AWX, so we need some way of generating our inventory outside of more conventional means.

Thanks in advance!

> **(attachments)**
>
> ![Screen Shot 2021-07-02 at 1.33.41 PM.png](https://us1.discourse-cdn.com/ansible/original/2X/a/af633c9c1a22c525076161d6464b0247419ff3a6.png)

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 2, 2021, 5:42pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/2 "2021-07-02T17:42:07Z")

</div>

Sorry, meant AWX 19.2.0

---

<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:** [July 2, 2021, 9:02pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/3 "2021-07-02T21:02:09Z")

</div>

I have never used it like this. All i do is create the project from Project section (using credentials whatever that may be) and then i source it in the Inventory Source. There is no need to add the credentials from the inventory source section

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 5:17pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/4 "2021-07-06T17:17:06Z")

</div>

So if you don’t need the github creds, how do you get AWX to see the inventory files in the project? Do they have to be in a specific format? It’s only showing me the project root as a choice.

---

<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:** [July 6, 2021, 5:20pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/5 "2021-07-06T17:20:35Z")

</div>

Create a project of your inventory repository with the project resource. You are adding the credentials in the inventory source section. That’s not how I do it.

In your situation I would add the github repository to the project resource. Then I can add the git credentials as source control.

THEN I add that project to the inventory source.

I hope that makes sense. 🙂

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 5:24pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/6 "2021-07-06T17:24:05Z")

</div>

Actually, this is exactly how I have it set up! But still I don’t see the actual inventory files when adding it as an inventory source

---

<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:** [July 6, 2021, 5:24pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/7 "2021-07-06T17:24:19Z")

</div>

Question.

Have you added the GitHub repo and successfully synced it?

Is your inventory in yml or ini format?

---

<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:** [July 6, 2021, 5:25pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/8 "2021-07-06T17:25:25Z")

</div>

Are you using ini or yml?

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 5:26pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/9 "2021-07-06T17:26:44Z")

</div>

I have tried ini, but not yaml. I can certainly try that and see if it works any differently.

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 5:27pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/10 "2021-07-06T17:27:36Z")

</div>

Oh, and yes, the repository has successfully synced 🙂

---

<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:** [July 6, 2021, 5:28pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/11 "2021-07-06T17:28:47Z")

</div>

Ok i have used ini and it works. Where did you put The file? Is it possible to see a sample of your layout?

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 6:25pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/12 "2021-07-06T18:25:16Z")

</div>

Well, I created a yml inventory, and it at least syncs now. The project and the inventory source shows a successful sync. However, I wonder if there’s a way to display the inventory because using it to run a job from a template says that there is no matching host for a host that I know is in the inventory file:

Identity added: /runner/artifacts/58/ssh\_key\_data (/runner/artifacts/58/ssh\_key\_data)  
[WARNING]: You are running the development version of Ansible. You should only  
run Ansible from “devel” if you are modifying the Ansible engine, or trying out  
features under development. This is a rapidly changing source of code and can  
become unstable at any point.  
[WARNING]: provided hosts list is empty, only localhost is available. Note that  
the implicit localhost does not match ‘all’  
[WARNING]: Could not match supplied host pattern, ignoring:  
[myhost.mydomain.com](http://myhost.mydomain.com)

PLAY [[myhost.mydomain.com](http://myhost.mydomain.com)] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: no hosts matched

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

---

<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:** [July 6, 2021, 6:29pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/13 "2021-07-06T18:29:53Z")

</div>

Yes yoy can look at inventory at your left.

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 6:35pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/14 "2021-07-06T18:35:39Z")

</div>

I see. So maybe it’s not syncing properly now, because in the inventory, the list of hosts is empty, despite the inventory yaml file having \>600 hostnames in it. The hosts should be populated dynamically?

---

<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:** [July 6, 2021, 6:36pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/15 "2021-07-06T18:36:47Z")

</div>

What is in the job when you sync?

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 6:44pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/16 "2021-07-06T18:44:02Z")

</div>

**[WARNING]: You are running the development version of Ansible. You should only**

**run Ansible from “devel” if you are modifying the Ansible engine, or trying out**

**features under development. This is a rapidly changing source of code and can**

**become unstable at any point.**

ansible-inventory [core 2.12.0.dev0]

config file = None

configured module search path = [‘/home/runner/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]

ansible python module location = /usr/local/lib/python3.8/site-packages/ansible

ansible collection location = /runner/requirements\_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections

executable location = /usr/local/bin/ansible-inventory

python version = 3.8.3 (default, Aug 31 2020, 16:03:14) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

jinja version = 2.10.3

libyaml = True

No config file found; using defaults

host\_list declined parsing /runner/project/mit.yml as it did not pass its verify\_file() method

script declined parsing /runner/project/mit.yml as it did not pass its verify\_file() method

**[WARNING]: Skipping ‘hosts’ as this is not a valid group definition**

Parsed /runner/project/mit.yml inventory source with yaml plugin

This is the output when the source syncs. I’m not sure what the verify\_file() error means. My yml file takes this format:  
hosts:

- [myhost1.mydomain.com](http://myhost1.mydomain.com)
- [myhost2.mydomain.com](http://myhost2.mydomain.com)
- [myhost3.mydomain.com](http://myhost3.mydomain.com)

and so forth.

---

<div class="post-metadata">

**Author:** ![Paul\_G](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Paul\_G](https://forum.ansible.com/u/Paul_G)\
**Post date:** [July 6, 2021, 7:52pm UTC](https://forum.ansible.com/t/cant-use-github-enterprise-credential-in-inventory-source/35454/17 "2021-07-06T19:52:17Z")

</div>

An update, I retried using an ini file, and this time it worked! Possibly I had a misconfiguration last time I used it. At any rate, thank you for your help!
