add the limit option, which can be used to further confine the patterns selected by "hosts:" in ansible-playbooks

to an additional pattern (a subset) specified on the command line.  For instance, a playbook could be reusable
and target "webservers" and "dbservers", but you want to test only in the stage environment, or a few boxes at a time.
This commit is contained in:
Michael DeHaan 2012-08-10 02:45:29 -04:00
commit 1c81ddf8d4
6 changed files with 38 additions and 8 deletions

View file

@ -52,7 +52,7 @@ def main(args):
# create parser for CLI options
usage = "%prog playbook.yml"
parser = utils.base_parser(constants=C, usage=usage, connect_opts=True, runas_opts=True)
parser = utils.base_parser(constants=C, usage=usage, connect_opts=True, runas_opts=True, subset_opts=True)
parser.add_option('-e', '--extra-vars', dest="extra_vars", default=None,
help="set additional key=value variables from the CLI")
parser.add_option('-t', '--tags', dest='tags', default='all',
@ -102,6 +102,7 @@ def main(args):
extra_vars=extra_vars,
private_key_file=options.private_key_file,
only_tags=only_tags,
subset=options.subset,
)
try: