Jay Taylor's notes

back to listing index

Ansible Stuff - Open edX Operations - Confluence

[web search]
Original source (openedx.atlassian.net)
Tags: ansible documentation variable-precedence openedx.atlassian.net
Clipped on: 2016-03-07

Skip to end of banner
Skip to end of metadata
Go to start of metadata
  • Included meta-dependencies are only executed once UNLESS they're called with different arguments
  • Variables passed to meta-dependencies are SCOPED! Running the role with arguments, then running it without has those variables be undefined.
  • All modules specify #!/usr/bin/python explicitly. This can be a problem if you're using local actions and your python lives somewhere else.

Variable Precedence (version 1.2)

1) Variables defined in the play under vars_files

vars_files:
  - "/path/to/var/file"

2) Variables defined in <role>/vars/main.yml

3) Variables passed in on the command line

ansible-playbook ... -e "test_var=foo"

4) Variables defined in the play under vars

vars:
  test_var: foo

5) Variables defined in group_vars/

edX Variable conventions

Role variables

Default variables for roles should all be defined in <role>/vars/main.yml file associated with the role. This is currently not the lowest priority definition, in fact it's the number (2) in precedence. Ansible 1.3 will be introducing new role default vars which will allow us to

Ali Hasan likes this
  • No labels

Image (Asset 2/2) alt=

Write a comment…