There are two features in Ansible 1.3 that were alluded to previously in the chapter. The first feature is the metadata
roles. They allow you to specify that your role depends on other roles. For example, if the application that you are deploying needs to send mail, your role could depend on a Postfix
role. This would mean that before the application is set up and installed, Postfix
will be installed and set up.
The meta/main.yml
file would look similar to the following code:
--- allow_duplicates: no dependencies: - apache
The allow_duplicates
line is set to no
, which is the default. If you set this to no
, Ansible will not run a role the second time, if it is included twice with the same arguments. If you set it to yes
, it will repeat the role even if it has run before. You can leave it off
instead of setting it to no
.
Dependencies are specified in the same format as roles. This means, you can pass variables here; either static values or variables that are passed to the...