3
We also can include files with tasks: conditionally or unconditionally or even in the loop (variables are propogated)
8
Or we can define a complete role, which may define the tasks, handlers, variables, etc. The roles are included from top
13
- role2 param1=5000 - parametrizing
16
Including role from other roles.
19
*_from: filename.yml - overrides the file to load vars/tasks/defaults from. I.e. instead main.yml the specified YaML description will be used
23
It is also possible to icnlude a file with variables as a new variable with the specified name:
24
- include_vars: file=vars.yml name=var_name - if name is ommited, the top level vars are loaded
25
dir=<path> [extensions=list] [depth=l] [files_matching=re] - if dir is specified, all files matching 're' in the directory and its subdirectoris until level 'l' are loaded.
26
BEWARE: main.yml for some reason may be not included!
30
meta/ - information about the role
32
defaults/ - define default (least priority) facts for the role
33
main.yml - variables from here are not propogated to next roles by default, but should be passed using 'set_fact'
35
main.yml - includede by default
36
vars1.yml - variables included with 'vars_files'
37
templates/ - various templates used in tasks
39
files/ - various files used in tasks and possibly distributed to the configured nodes
42
main.yml - this task list is executed when roles in included, and may include more files from this folder
43
action1.yml - this is not executed by default, but can be included from main.yml
44
handlers/ - define hanlders for the role
46
library/ - custom modules
47
*_plugins/ - various python plugins
52
dependencies: - ensures that listed roles are executed before this one
53
- { role: common, param1: val1, ... }
54
allow_duplicates: yes - enforces all dependencies to be run before the role (even if they have been already executed in this playbook)