Ansible dynamic inventory script that reads any Ansible hosts file and transforms it into the JSON data structure.
This was moved to https://github.com/jtyr/ansible-ini_inventory |
This comment has been minimized.
This comment has been minimized.
I am having the same issue as @andrew-sumner...would love to know if anyone knows of a fix edit |
This comment has been minimized.
This comment has been minimized.
Found this tip really useful. Thanks for putting this together. got me looking for what I needed in the 2.4 patch Here's something similar to what I've implemented in my code. from ansible.plugins.inventory import expand_hostname_range, detect_range
def my_expand(host_line):
hosts = []
if detect_range(host_line):
hosts += expand_hostname_range(host_line)
else:
hosts += [host_line]
return hosts |
This comment has been minimized.
This comment has been minimized.
Something like this should work https://gist.github.com/narkq/300e2c85f2054353d3034afde3ea846e |
This comment has been minimized.
This comment has been minimized.
I have fixed to error and moved the script into a proper GitHub repo here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
This doesn't work for me after upgrading to Ansible 2.4 as it's unable to find InventoryParser. Do you have a fix (or suggestion) for this?