ansible/ansible — pull request #9416 by eloycoto (2014-10-24 16:53:49+00:00)
Title: Callbacks set_fact name resolution

Hi,

I made this small PR to send set_fact variables to the callbacks. The problem was:

**Example playbook:**
```
- name: Apply common config
hosts: all
tasks:
- name: Set result result to 11
set_fact: result="11"

- name: Get result variable = {{result}}
command: echo "1"
```

**Current behavior:**
```
PLAY [Apply common config] ****************************************************

GATHERING FACTS ***************************************************************
ok: [172.20.10.41]
ok: [172.20.10.47]

TASK: [Set result result to 11] ***********************************************
ok: [172.20.10.41]
ok: [172.20.10.47]

TASK: [Get result variable = {{result}}] **************************************
changed: [172.20.10.41]
changed: [172.20.10.47]
```

If you try to get the value of {{result}} in name, it was impossible. I made small function to return at least a dictionary with {host:value} structure. I know that it's not clear, but I didn't found any other solution. In the other hand, sometimes get the var value in the name it's useful.

**Behavior with the changes:**
```
PLAY [Apply common config] ****************************************************

GATHERING FACTS ***************************************************************
ok: [172.20.10.41]
ok: [172.20.10.47]

TASK: [Set result result to 11] ***********************************************
ok: [172.20.10.47]
ok: [172.20.10.41]

TASK: [Get result variable = {'172.20.10.47': u'11', '172.20.10.41': u'11'}] ***
changed: [172.20.10.41]
changed: [172.20.10.47]
```

Keep the option as name=value it's quite difficult. If you are running only one host it's ok, in case of two or more host, you can't do.

Regards.