Is it still unclear Brian?
I also seem to be seeing a related problem. Consider:
- name: Provision Ops RDS instance
hosts: localhost
connection: local
gather_facts: no
tags: [control]
tasks:
...
- shell: |
echo {{groups.consul_server[0]}} && hostname -i && curl localhost:
8500/v1/catalog/services
register: __catalog
delegate_to: groups.consul_server[0]
Here the shell commands runs on localhost, not the host specified. The
output is
TASK: [shell echo {{groups.consul_server[0]}} && hostname -i && curl
localhost:8500/v1/catalog/services
] ***
<groups.consul_server[0]> REMOTE_MODULE command echo 10.0.196.116 &&
hostname -i && curl localhost:8500/v1/catalog/services #USE_SHELL
<groups.consul_server[0]> EXEC ['/bin/sh', '-c', 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1437044596.27-54518627543713 && chmod a+rx
$HOME/.ansible/tmp/ansible-tmp-1437044596.27-54518627543713 && echo
$HOME/.ansible/tmp/ansible-tmp-1437044596.27-54518627543713']
<groups.consul_server[0]> PUT /tmp/tmpTGBlM3 TO /home/bkaplan/.ansible/tmp/
ansible-tmp-1437044596.27-54518627543713/command
<groups.consul_server[0]> 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-1437044596.27-54518627543713/command;
rm -rf /home/bkaplan/.ansible/tmp/ansible-tmp-1437044596.27-54518627543713/
>/dev/null 2>&1']
failed: [localhost -> groups.consul_server[0]] => {"changed": true, "cmd":
"echo
10.0.196.116 && hostname -i && curl localhost:8500/v1/catalog/services",
"delta": "0:00:00.012358", "end": "2015-07-16 16:33:16.332372", "rc": 7,
"start": "2015-07-16 16:33:16.320014", "warnings": []}
stderr: % Total % Received % Xferd Average Speed Time Time
Time Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0curl: (7) Failed to connect to localhost port 8500: Connection refused
stdout: 10.0.196.116
127.0.1.1
Where '10.0.196.116' is groups.consul_server[0]. So the variable resolves
correctly, but delegate to does not seem to use it. This is not specific to
shell, it has the same behavior for other modules (eg, uri).
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/55a50ab9-e411-4d2a-9a6a-ec79eee7fe16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.