...
|
...
|
@@ -239,10 +239,17 @@ class PlayBook(object):
|
239
|
239
|
|
240
|
240
|
# *****************************************************
|
241
|
241
|
|
|
242
|
+ def _list_available_hosts(self):
|
|
243
|
+ ''' returns a list of hosts that haven't failed and aren't dark '''
|
|
244
|
+
|
|
245
|
+ return [ h for h in self.inventory.list_hosts() if (h not in self.stats.failures) and (h not in self.stats.dark)]
|
|
246
|
+
|
|
247
|
+ # *****************************************************
|
|
248
|
+
|
242
|
249
|
def _run_task_internal(self, task):
|
243
|
250
|
''' run a particular module step in a playbook '''
|
244
|
251
|
|
245
|
|
- hosts = [ h for h in self.inventory.list_hosts() if (h not in self.stats.failures) and (h not in self.stats.dark)]
|
|
252
|
+ hosts = self._list_available_hosts()
|
246
|
253
|
self.inventory.restrict_to(hosts)
|
247
|
254
|
|
248
|
255
|
runner = ansible.runner.Runner(
|
...
|
...
|
@@ -340,8 +347,7 @@ class PlayBook(object):
|
340
|
340
|
def _do_setup_step(self, play):
|
341
|
341
|
''' get facts from the remote system '''
|
342
|
342
|
|
343
|
|
- host_list = [ h for h in self.inventory.list_hosts(play.hosts)
|
344
|
|
- if not (h in self.stats.failures or h in self.stats.dark) ]
|
|
343
|
+ host_list = self._list_available_hosts()
|
345
|
344
|
|
346
|
345
|
if play.gather_facts is False:
|
347
|
346
|
return {}
|
...
|
...
|
@@ -390,8 +396,7 @@ class PlayBook(object):
|
390
|
390
|
|
391
|
391
|
# now with that data, handle contentional variable file imports!
|
392
|
392
|
|
393
|
|
- all_hosts = [ h for h in self.inventory.list_hosts(play.hosts)
|
394
|
|
- if not (h in self.stats.failures or h in self.stats.dark) ]
|
|
393
|
+ all_hosts = self._list_available_hosts()
|
395
|
394
|
play.update_vars_files(all_hosts)
|
396
|
395
|
|
397
|
396
|
serialized_batch = []
|
...
|
...
|
@@ -426,8 +431,7 @@ class PlayBook(object):
|
426
|
426
|
# just didn't match anything and that's ok
|
427
|
427
|
return False
|
428
|
428
|
|
429
|
|
- host_list = [ h for h in self.inventory.list_hosts(play.hosts)
|
430
|
|
- if not (h in self.stats.failures or h in self.stats.dark) ]
|
|
429
|
+ host_list = self._list_available_hosts()
|
431
|
430
|
|
432
|
431
|
# if no hosts remain, drop out
|
433
|
432
|
if not host_list:
|