ansible/ansible — pull request #7917 by ingmar (2014-06-24 17:04:12+00:00)
Title: Add `--limit` option to ansible-pull.

This adds the same `--limit` option to **ansible-pull** that **ansible-playbook** already had. The option is simply passed through to **ansible-pull**, in addition to the hardcoded `--limit` of `localhost:$HOSTNAME:127.0.0.1`. This basically enables folk to extend the hardcoded limit, which was previously not possible.

The reason for this is a bit complicated. In short, it was interfering with the combination of ansible-pull and dynamic inventories that add important variables. In a playbook that is invoked at startup to self-update newly launched EC2 instances in an autoscaling group, we rely on several variables added by a dynamic inventory script (ec2.py). These would not be found if the host was not addressed by its proper name (the public EC2 DNS name in this case). So localhost or 127.0.0.1 would not pick these up. The system hostname (the one ansible retrieves via `socket.getfqdn()`) does not match the inventory name, for a number of reasons (mostly related to EC2 names being gibberish, and hostnames being used in various places to identify and group instances in external services such as remote syslog and monitoring). So the hardcoded limit was just not working, and *there was no way to tell ansible-pull to use the hostname we wanted*. This adds that way, without interfering in any way with how ansible-pull works when it is simply omitted.