...
- YAML files - All yaml files should use 2 space indents and end with
.yml
- Variables - Use jinja variable syntax over deprecated variable syntax.
{{ var }}
not$var
- Use spaces around jinja variable names.
{{ var }}
not{{var}}
- Variables that are environment specific and that need to be overridden should be in ALL CAPS.
- Variables that are internal to the role should be lowercase.
- Prefix all variables defined in a role with the name of the role. Example:
EDXAPP_FOO
- Keep roles self contained - Roles should avoid including tasks from other roles when possible
- Plays should do nothing more than include a list of roles except where pre_tasks and post_tasks are required (to manage a load balancer for example)
- Plays/Playbooks that apply to the general community should be copied to configuration/playbooks
- Plays/Playbooks that apply only to a specific organization (edx-east, edx-west) should be copied to a sub-directory under configuration/playbooks
- Handlers - Do not use handlers. If you need to restart an app when specific tasks run, just add a task to do so at the end of the playbook. If necessary, it can be skipped with tags (see Role Life-cycle)
- Separators - Use underscores (e.g.
my_role
) not dashes (my-role
). - Paths - When defining paths, do not include trailing slashes (e.g.
my_path: /foo
notmy_path: /foo/
. When concatenating paths, follow the same convention (e.g.{{ my_path }}/bar
not{{ my_path }}bar
) - Tag tasks using the tags described in Role Life-cycle
Conditionals and Return Status
...