mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Add a "-o" override option so hosts not in a playbook can still be managed by a playbook.
This commit is contained in:
parent
b213437bfa
commit
9df612f007
3 changed files with 39 additions and 21 deletions
|
@ -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")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue