I see the same behavior with the moustaches: - name: Test delegate to shell: echo "{{ groups.consul_server[0] }}" && hostname -i register: __hostname
delegate_to: "{{ groups.consul_server[0] }}" - debug: var=__hostname TASK: [Test delegate to] ********************************************* <10.0.196.116> REMOTE_MODULE command echo "10.0.196.116" && hostname -i #USE_SHELL <10.0.196.116> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1437108695.64-26819269533917 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1437108695.64-26819269533917 && echo $HOME/.ansible/tmp/ansible-tmp-1437108695.64-26819269533917'] <10.0.196.116> PUT /tmp/tmpDXWJFH TO /home/bkaplan/.ansible/tmp/ansible-tmp- 1437108695.64-26819269533917/command <10.0.196.116> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/bkaplan/.ansible/tmp/ansible-tmp-1437108695.64-26819269533917/command; rm -rf /home/bkaplan/.ansible/tmp/ansible-tmp-1437108695.64-26819269533917/ >/dev/null 2>&1'] changed: [localhost -> 10.0.196.116] => {"changed": true, "cmd": "echo \"10.0.196.116\" && hostname -i", "delta": "0:00:00.004458", "end": "2015-07-17 10:21:35.693136", "rc": 0, "start": "2015-07-17 10:21:35.688678", "stderr": "", "stdout": "10.0.196.116\n127.0.1.1", "warnings": []} TASK: [debug var=__hostname] ************************************************** ok: [localhost] => { "var": { "__hostname": { "changed": true, "cmd": "echo \"10.0.196.116\" && hostname -i", "delta": "0:00:00.004458", "end": "2015-07-17 10:21:35.693136", "invocation": { "module_args": "echo \"10.0.196.116\" && hostname -i", "module_name": "shell" }, "rc": 0, "start": "2015-07-17 10:21:35.688678", "stderr": "", "stdout": "10.0.196.116\n127.0.1.1", "stdout_lines": [ "10.0.196.116", "127.0.1.1" ], "warnings": [] } } } -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c2e3db4a-3f70-4804-99af-cda0032e9f47%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.