ansible/ansible — pull request #652 by fangchin (2012-07-22 23:50:58+00:00)
Title: Devel

Summary
========

This is a small enhancement to the latest ansible devel in response to the mailing list post [simple pattern in /etc/ansible/hosts file so as to be DRY?](https://groups.google.com/forum/#!topic/ansible-project/SJ-1QIyYtHc). The enhancement enables the use of a host line in the inventory file with the format `base[beg:end:step]tail`. For example, in `data[1:6:2]-node.example.com`, `data` is the base, `beg` is 1, `end` is 6, `step` is 2, and `-node.example.com` is the tail. If left out, `beg` defaults to 0, and `step` defaults to 1.

Note that since YAML inventory format is deprecated, so I only did the enhancement to the `lib/ansible/inventory/ini.py`. I also added a small module `lib/ansible/inventory/expand_host.py` with integrated self-tests.

Details
=====

I have followed the instructions in the `README.md` closely. After the enhancements, `make tests` still all pass. The following is a list of files that I have changed:
1. `CHANGELOG.md` - added a brief description about what has been done.
2. `Makefile` - fixed the instruction for making a deb package
3. `docs/man/man1/ansible.1` - updated the **INVENTORY** sub-section.
4. `example/hosts` - updated with a few additional examples
5. `lib/ansible/inventory/expand_hosts.py` - the aforementioned small module
6. `lib/ansible/inventory/ini.py` - added necessary import statements and additional checks in `_parse_base_groups(self)`

Thanks for creating this wonderful tool. I hope you find this enhancement good enough to be included in the distribution.

Regards,

Chin Fang, Zettar Inc.