Open shawnweeks opened 1 year ago
It seems to me that Currently it only works with files that have names hosts, inventory, *.ini, for the inventory files and with a limit of 50 files
I use the structure described at the bottom of https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html for all of my Ansible projects. Would it make sense to expand it to inventory/ as well?
here is the code to try to quickly determine if a file is inventory or not
it only looks at the first 10 lines of code -- do your inventory files have comments or anything at the beginning of the file?
No, they do not contain any comments at the top. Here is a snippet from one of the inventory files.
all:
children:
pve:
hosts:
cloud1:
ip_suffix: 11
mgmt_net_adapter_1: eno3
mgmt_net_adapter_2: eno4
vm_net_adapter: eno1
ceph_net_adapter: enp65s0
cloud2:
ip_suffix: 12
mgmt_net_adapter_1: eno3
mgmt_net_adapter_2: eno4
vm_net_adapter: eno1
ceph_net_adapter: enp65s0
cloud3:
ip_suffix: 13
mgmt_net_adapter_1: eno3
mgmt_net_adapter_2: eno4
vm_net_adapter: eno1
ceph_net_adapter: enp65s0
No, they do not contain any comments at the top. Here is a snippet from one of the inventory files.
all: children: pve: hosts: cloud1: ip_suffix: 11 mgmt_net_adapter_1: eno3 mgmt_net_adapter_2: eno4 vm_net_adapter: eno1 ceph_net_adapter: enp65s0 cloud2: ip_suffix: 12 mgmt_net_adapter_1: eno3 mgmt_net_adapter_2: eno4 vm_net_adapter: eno1 ceph_net_adapter: enp65s0 cloud3: ip_suffix: 13 mgmt_net_adapter_1: eno3 mgmt_net_adapter_2: eno4 vm_net_adapter: eno1 ceph_net_adapter: enp65s0
try to name the file as inventory or hosts, without extension, even if it is a yaml
Changing the name of the files really isn't practical, is there a particular reason why *.ini
was allowed and *.yml
isn't even though the documentation for Ansible suggests that file extension for your inventory? Looking at the code this just seems to be something that was missed, I can submit a PR adding it but there is no point if it was intentionally left out.
Changing the name of the files really isn't practical, is there a particular reason why
*.ini
was allowed and*.yml
isn't even though the documentation for Ansible suggests that file extension for your inventory? Looking at the code this just seems to be something that was missed, I can submit a PR adding it but there is no point if it was intentionally left out.
Well I don't really have the answer, it's just a recommendation to validate the issue, based on what I see in the code. If that works for you, it could be better analyzed if a pull request is necessary :-)
for the record, I did a test by creating an inventory with yaml format and name the file hosts and it loads it to the drop down list and also to the inventory the hosts, groups
all:
children:
prod:
children:
database:
children:
central:
hosts:
host1:
host2:
The test was also made to manually place the path of the yml file with the name, since the filter is only for the dropdown list to show them, but if we write it if it loads the inventory in the yml
Please confirm the following
Bug Summary
When sourcing inventory from a Git based Project the inventory file drop down menu is empty. Typing in a known inventory yaml file path works. Other places that use project files like the Job Template page correctly show all the available files in the drop down including inventory files.
AWX version
21.13.0
Select the relevant components
Installation method
kubernetes
Modifications
no
Ansible version
No response
Operating system
Rocky 8
Web browser
Firefox
Steps to reproduce
inventory/
folder and multiple inventory files with.yml
extension.Expected results
Inventory file list should show the files from the project.
Actual results
Inventory list just shows
/ (project root)
Additional information
This is a basic install using the AWX Operator on a single node K3s installation with all defaults and no configuration changes inside of AWX.