Demo of parameterized roles!

This commit is contained in:
Michael DeHaan
2013-04-06 12:51:17 -04:00
parent f308194b9a
commit 5c4ed72571
3 changed files with 32 additions and 5 deletions

View File

@@ -7,3 +7,8 @@
template: src=foo.j2 dest=/tmp/roles_test2.txt
notify:
- blippy
- name: demo that parameterized roles work
shell: echo just FYI, param1={{ param1 }}, param2 ={{ param2 }}

View File

@@ -26,13 +26,21 @@
- hosts: all
roles:
- foo
# a role can be listed flat like this:
#
# - common
# - webservers
# but you can also pass variables to them, so they can be parameterized. You can call
# a role more than once with different parameters too. It might look like this:
- { role: foo, param1: 1000, param2: 2000 }
- { role: foo, param1: 8000, param2: 9000 }
# add as many roles as you like, roles takes a list of roles names
# these paths can be qualified, but if bare, it will look from them in
# roles/$rolename relative to the playbook
#
# - bar
# explicit tasks and handlers can be used, but are not required.
# they will run after the roles if present.