From ba9468266f6bd9b19583ae9f2870f845a09ab24c Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sun, 5 Feb 2012 13:05:09 -0500 Subject: [PATCH] Can it get an easier? Yes it can! Further simply playbook format. --- examples/playbook.yml | 12 ++++++------ lib/ansible/playbook.py | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/playbook.yml b/examples/playbook.yml index 4d5972b4c21..d79e4935616 100644 --- a/examples/playbook.yml +++ b/examples/playbook.yml @@ -2,21 +2,21 @@ tasks: - do: - configure template & module variables - - [ setup, [ "a=2", "b=3", "c=4" ] ] + - setup a=2 b=3 c=4 - do: - copy a file - - [ copy, [ "/srv/a", "/srv/b" ] ] + - copy /srv/a /srv/b - do: - template from local file template.j2 to remote location /srv/file.out - - [ template, [ '/srv/template.j2', '/srv/file.out' ] ] + - template /srv/template.j2 /srv/file.out - do: - update apache - - [ command, [/usr/bin/yum, update, apache] ] + - command /usr/bin/yum update apache onchange: - do: - restart apache - - [ command, [/sbin/service, apache, restart] ] + - command /sbin/service apache restart - do: - run bin false - - [ command, [/bin/false] ] + - command /bin/false diff --git a/lib/ansible/playbook.py b/lib/ansible/playbook.py index 590b0270f4a..769c315864f 100755 --- a/lib/ansible/playbook.py +++ b/lib/ansible/playbook.py @@ -23,6 +23,7 @@ import ansible.runner import ansible.constants as C import json import yaml +import shlex # TODO: make a constants file rather than # duplicating these @@ -111,7 +112,9 @@ class PlayBook(object): instructions = task['do'] (comment, module_details) = instructions - (module_name, module_args) = module_details + tokens = shlex.split(module_details) + module_name = tokens[0] + module_args = tokens[1:] namestr = "%s/%s" % (pattern, comment) if conditional: