mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Demo of parameterized roles!
This commit is contained in:
@@ -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 }}
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user