Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save git-ksa/a94deb2f8d1339ffcb07ff578bea561b to your computer and use it in GitHub Desktop.

Select an option

Save git-ksa/a94deb2f8d1339ffcb07ff578bea561b to your computer and use it in GitHub Desktop.

Revisions

  1. @ekreutz ekreutz created this gist Dec 22, 2017.
    27 changes: 27 additions & 0 deletions ansible_variable_precedence.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # Ansible variable precedence

    Source: http://docs.ansible.com/ansible/latest/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable

    ### From least to most important

    - role defaults
    - inventory file or script group vars
    - inventory group_vars/all
    - playbook group_vars/all
    - inventory group_vars/*
    - playbook group_vars/*
    - inventory file or script host vars
    - inventory host_vars/*
    - playbook host_vars/*
    - host facts
    - play vars
    - play vars_prompt
    - play vars_files
    - role vars (defined in role/vars/main.yml)
    - block vars (only for tasks in block)
    - task vars (only for the task)
    - role (and include_role) params
    - include params
    - include_vars
    - set_facts / registered vars
    - extra vars (always win precedence)