March 2019
Intermediate to advanced
412 pages
9h 49m
English
As stated before, roles can depend on other roles. These relationships are called dependencies and they are described in a role's meta/main.yaml file. This file expects a top-level data hash with a key of dependencies; the data within is a list of roles:
--- dependencies: - role: common - role: apache
In this example, Ansible will fully process the common role first (and any dependencies it may express) before continuing with the apache role and then finally starting on the role's tasks.
Dependencies can be referenced by name without any prefix if they exist within the same directory structure or live within the configured roles_path. Otherwise, full paths can be used to locate roles:
role: /opt/ansible/site-roles/apache ...
Read now
Unlock full access