I have been using ansible for a while now, and really like it.
Unless I have missed it In http://ansible.github.com/patterns.html#hosts-and-groups, we need to enumerate all hosts in a group, even the names of such hosts are very similar, e.g. host0, host1, host2, host3 etc and thus can be more succinctly specified as host[1-3] instead.
I know that adding such additional parsing of a plain ini style file adds complexity to the core codes. But, IMHO if such a capability is not implemented yet, it might be worth considering?
Just a suggestion.
Regards,
Zack
I know that adding such additional parsing of a plain ini style file adds complexity to the core codes. But, IMHO if such a capability is not implemented yet, it might be worth considering?
You may want to consider code-generating the file or using an external inventory script if you need something immediate, but I would take patches to allow this sort of expansion of host records.
However, if you do this, it should be done consistently for both the INI and YAML style parsers.
Hi Michael,
but I would take patches to allow this sort of
expansion of host records.
However, if you do this, it should be done consistently for
both the INI and YAML style parsers.
OK. I see what you mean. in ansible/lib/ansible/inventory/__init__.py I saw the following:
71 data = file(host_list).read()
72 if not data.startswith("---"):
73 self.parser = InventoryParser(filename=host_list)
74 self.groups = self.parser.groups.values()
75 else:
76 self.parser = InventoryParserYaml(filename=host_list)
77 self.groups = self.parser.groups.values()
I will see what I can come up with.
Regards,
Zack
Hi Michael,
Just a quick follow-up to my prior email.
However, if you do this, it should be done consistently for
both the INI and YAML style parsers.
Different sites tend to use different host naming conventions. Our own convention here is usually the following:
* All hosts are categorized into different and non-overlapping categories (usually according the major functions of a set of nodes)
* For all hosts in a category, they share a common base name (e.g. nn => name nodes, tn => tracker nodes, dn => data nodes), and then followed by digits (0 .. N). A full example: nn01
This is quite simple to deal with. But if I work on a patch, I would like to make it more generally useful. Perhaps we should solicit others inputs in this regard?
Regards,
Zack