ansible/ansible — pull request #9640 by hkariti (2014-11-26 13:51:02+00:00)
Title: Don't template play vars by themselves, it's too early

##### Summary

Templating the play variables before the rest of the variables are loaded can lead to wrong results in variables.

##### Example inventory:

```
localhost ansible_connection=local
[all:vars]
var=value
```

##### Example playbook:

```
---
- name: Default value for inventory variable
hosts: localhost
gather_facts: no
vars:
var2: "{{ var | default('none') }}"
tasks:
- debug: var=var
- debug: var=var2
```

##### Expected results:

```
PLAY [Default value for inventory variable] ***********************************

TASK: [debug var=var] *********************************************************
ok: [localhost] => {
"var": "value"
}

TASK: [debug var=var2] ********************************************************
ok: [localhost] => {
"var2": "value"
}
```

##### Actual results:

```
PLAY [Default value for inventory variable] ***********************************

TASK: [debug var=var] *********************************************************
ok: [localhost] => {
"var": "value"
}

TASK: [debug var=var2] ********************************************************
ok: [localhost] => {
"var2": "none"
}
```