include_role
Load and execute a role in the current play
Collection: builtin
Full Name: parallax.builtin.include_role
Aliases: include_role, ansible.builtin.include_role
Controller module — runs on the local controller, not on remote hosts.
Synopsis
Load and execute a role in the current play
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | yes | Role to execute in the current play | |
| tasks_from | string | main | Task entry point in the role tasks directory | |
| vars_from | string | main | Variable entry point in the role vars directory | |
| defaults_from | string | main | Default variable entry point in the role defaults directory | |
| handlers_from | string | main | Handler entry point in the role handlers directory | |
| public | bool | false | Expose role defaults and variables to following tasks | |
| apply | map | Task keywords applied to the included role tasks | ||
| allow_duplicates | bool | true | Allow repeating the same role invocation | |
| rolespec_validate | bool | true | Validate the selected role entry point arguments |
Example
yaml
- name: Apply the webserver role
ansible.builtin.include_role:
name: webserver
public: false