Commit 0e5e2c6e authored by ale's avatar ale

Support the --limit option (passthru to ansible-playbook)

parent bf95f7f8
Pipeline #6911 passed with stages
in 13 minutes
......@@ -156,6 +156,7 @@ def command_run(config, playbooks,
ansible_check=False,
ansible_diff=False,
ansible_stdout=None,
ansible_limit=None,
ansible_extra_vars=[]):
if not os.path.exists(config):
raise Exception(
......@@ -185,6 +186,8 @@ def command_run(config, playbooks,
cmd.append('--check')
if ansible_diff:
cmd.append('--diff')
if ansible_limit:
cmd.extend(['--limit', ansible_limit])
for v in ansible_extra_vars:
cmd.append('--extra-vars=' + v)
cmd.append(arg)
......@@ -398,6 +401,9 @@ themselves.
'-e', '--extra-vars', dest='ansible_extra_vars',
action='append', default=[],
help='Extra variables for Ansible')
run_parser.add_argument(
'-l', '--limit', dest='ansible_limit',
help='Limit to selected hosts')
kwargs = vars(parser.parse_args())
cmd = kwargs.pop('subparser')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment