Merge pull request #2622 from skvidal/playbook-start-at-task

implement --start-at-task option to hop to a specific task before starti...
This commit is contained in:
Michael DeHaan 2013-04-11 11:17:24 -07:00
commit 3e736eaf00
2 changed files with 13 additions and 1 deletions

View file

@ -21,6 +21,7 @@ import getpass
import os
import subprocess
import random
import fnmatch
from ansible.color import stringc
cowsay = None
@ -460,8 +461,15 @@ class PlaybookCallbacks(object):
msg = "TASK: [%s]" % name
if is_conditional:
msg = "NOTIFIED: [%s]" % name
if hasattr(self, 'start_at'):
if name == self.start_at or fnmatch.fnmatch(name, self.start_at):
# we found out match, we can get rid of this now
del self.start_at
if hasattr(self, 'step') and self.step:
if hasattr(self, 'start_at'): # we still have start_at so skip the task
self.skip_task = True
elif hasattr(self, 'step') and self.step:
resp = raw_input('Perform task: %s (y/n/c): ' % name)
if resp.lower() in ['y','yes']:
self.skip_task = False