Add a "-o" override option so hosts not in a playbook can still be managed by a playbook.

This commit is contained in:
Michael DeHaan 2012-03-24 16:19:38 -04:00
parent b213437bfa
commit 9df612f007
3 changed files with 39 additions and 21 deletions

View file

@ -149,9 +149,14 @@ class Runner(object):
# *****************************************************
@classmethod
def parse_hosts(cls, host_list):
def parse_hosts(cls, host_list, override_hosts=None):
''' parse the host inventory file, returns (hosts, groups) '''
if override_hosts is not None:
if type(override_hosts) != list:
raise errors.AnsibleError("override hosts must be a list")
return (override_hosts, dict(ungrouped=override_hosts))
if type(host_list) == list:
raise Exception("function can only be called on inventory files")