From f939f3fdafcaec2402f0e32c0609d7fbdeb0606a Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 27 Apr 2012 00:08:06 -0400 Subject: [PATCH] Playbook can now take a 'name' which it will show when starting the play --- examples/playbooks/intro_example.yml | 3 ++- lib/ansible/playbook.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/playbooks/intro_example.yml b/examples/playbooks/intro_example.yml index 1fb31d2688..21bcff3d27 100644 --- a/examples/playbooks/intro_example.yml +++ b/examples/playbooks/intro_example.yml @@ -7,7 +7,8 @@ # on all hosts, run as the user root... -- hosts: all +- name: example play + hosts: all user: root # could have also have done: diff --git a/lib/ansible/playbook.py b/lib/ansible/playbook.py index bd5a3c33bd..038e5e5cee 100644 --- a/lib/ansible/playbook.py +++ b/lib/ansible/playbook.py @@ -553,7 +553,8 @@ class PlayBook(object): ''' run a list of tasks for a given pattern, in order ''' # get configuration information about the pattern - pattern = pg.get('hosts',None) + pattern = pg.get('hosts',None) + name = pg.get('name', pattern) if isinstance(pattern, list): pattern = ';'.join(pattern) if self.override_hosts: @@ -570,7 +571,7 @@ class PlayBook(object): sudo = pg.get('sudo', self.sudo) transport = pg.get('connection', self.transport) - self.callbacks.on_play_start(pattern) + self.callbacks.on_play_start(name) # push any variables down to the system # and get facts/ohai/other data back up self._do_setup_step(pattern, vars, user, port, sudo, transport, None)