mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
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:
parent
05a128c2be
commit
1c81ddf8d4
6 changed files with 38 additions and 8 deletions
|
@ -57,7 +57,8 @@ class PlayBook(object):
|
|||
sudo = False,
|
||||
sudo_user = C.DEFAULT_SUDO_USER,
|
||||
extra_vars = None,
|
||||
only_tags = None):
|
||||
only_tags = None,
|
||||
subset = C.DEFAULT_SUBSET):
|
||||
|
||||
"""
|
||||
playbook: path to a playbook file
|
||||
|
@ -104,7 +105,8 @@ class PlayBook(object):
|
|||
self.private_key_file = private_key_file
|
||||
self.only_tags = only_tags
|
||||
|
||||
self.inventory = ansible.inventory.Inventory(host_list)
|
||||
self.inventory = ansible.inventory.Inventory(host_list)
|
||||
self.inventory.subset(subset)
|
||||
|
||||
if not self.inventory._is_script:
|
||||
self.global_vars.update(self.inventory.get_group_variables('all'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue