Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Break long lines using yaml line continuation.

Reference: http://docs.ansible.com/playbooks_intro.html

Code Block
titleIncorrect
  - debugfile: >dest="{{ test }}" src="./foo.txt" mode=0077 state=present user="root" msg={{ test }}group="wheel"

 

Code Block
  - debugfile:
      msgdest: "{{ test }}"
	  src: "./foo.txt"
	  mode: 0077 
	  state: present
	  user: "root"
	  group: "wheel"

Roles

Role Variables

  • group_vars/all - Contains variable definitions that apply to all roles.
  • "common" role - Contains variables and tasks that apply to all roles that are edX specific.
  • Roles variables - Variables specific to a role should be defined in /vars/main.yml. All variables should be prefixed with the role name.
  • Role defaults - Default variables should configure a role to install edx in such away that all services can run on a single server
  • Variables that are environment specific and that need to be overridden should be in all caps.
  • Every role should have a standard set of role directories, example that includes a python and ruby virtualenv:

    Code Block
    edxapp_data_dir: "{{ COMMON_DATA_DIR }}/edxapp"
    edxapp_app_dir: "{{ COMMON_APP_DIR }}/edxapp"
    edxapp_log_dir: "{{ COMMON_LOG_DIR }}/edxapp"
    edxapp_venvs_dir: "{{ edxapp_app_dir }}/venvs"
    edxapp_venv_dir: "{{ edxapp_venvs_dir }}/edxapp"
    edxapp_venv_bin: "{{ edxapp_venv_dir }}/bin"
    edxapp_rbenv_dir: "{{ edxapp_app_dir }}"
    edxapp_rbenv_root: "{{ edxapp_rbenv_dir }}/.rbenv"
    edxapp_rbenv_shims: "{{ edxapp_rbenv_root }}/shims"
    edxapp_rbenv_bin: "{{ edxapp_rbenv_root }}/bin"
    edxapp_gem_root: "{{ edxapp_rbenv_dir }}/.gem"
    edxapp_gem_bin: "{{ edxapp_gem_root }}/bin"

...