1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Can it get an easier? Yes it can! Further simply playbook format.

This commit is contained in:
Michael DeHaan 2012-02-05 13:05:09 -05:00
parent 6d0fd2bfde
commit ba9468266f
2 changed files with 10 additions and 7 deletions

View file

@ -2,21 +2,21 @@
tasks: tasks:
- do: - do:
- configure template & module variables - configure template & module variables
- [ setup, [ "a=2", "b=3", "c=4" ] ] - setup a=2 b=3 c=4
- do: - do:
- copy a file - copy a file
- [ copy, [ "/srv/a", "/srv/b" ] ] - copy /srv/a /srv/b
- do: - do:
- template from local file template.j2 to remote location /srv/file.out - 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: - do:
- update apache - update apache
- [ command, [/usr/bin/yum, update, apache] ] - command /usr/bin/yum update apache
onchange: onchange:
- do: - do:
- restart apache - restart apache
- [ command, [/sbin/service, apache, restart] ] - command /sbin/service apache restart
- do: - do:
- run bin false - run bin false
- [ command, [/bin/false] ] - command /bin/false

View file

@ -23,6 +23,7 @@ import ansible.runner
import ansible.constants as C import ansible.constants as C
import json import json
import yaml import yaml
import shlex
# TODO: make a constants file rather than # TODO: make a constants file rather than
# duplicating these # duplicating these
@ -111,7 +112,9 @@ class PlayBook(object):
instructions = task['do'] instructions = task['do']
(comment, module_details) = instructions (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) namestr = "%s/%s" % (pattern, comment)
if conditional: if conditional: