Discussion:
[ansible-project] strange creating directory with delegate_to
Barry Kaplan
2015-07-17 07:31:43 UTC
Permalink
when running

- debug: var=groups.control

- name: Create facts.d directory on ops-control
file:
state: directory
path: /etc/ansible/facts.d
sudo: yes
delegate_to: "{{groups.control}}"

i get

TASK: [debug var=groups.control]
**********************************************
ok: [127.0.0.1] => {
"var": {
"groups.control": [
"10.0.196.112"
]
}
}


TASK: [Create facts.d directory on ops-control]
*******************************
fatal: [127.0.0.1 -> [u'10.0.196.112']] => Traceback (most recent call last
):
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py",
line 582, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py",
line 785, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.
module_args, inject, port, complex_args=complex_args)
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py",
line 923, in _executor_internal_inner
delegate = self._compute_delegate(actual_pass, inject)
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py",
line 363, in _compute_delegate
delegate['user'] = self._compute_delegate_user(self.delegate_to,
delegate['inject'])
File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py",
line 393, in _compute_delegate_user
if host in inject['hostvars']:
TypeError: unhashable type: 'list'


I've not yet seen this kind of error yet.
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3dd1d449-31c2-4394-b233-acc7d1c6fb05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-17 13:19:50 UTC
Permalink
delegate_to does not take lists, groups.control is a list, you need to
give it a single item or use with_items to cycle through the list.

In any case this is a bug as you should not get a traceback, but a
nice error message that tells you something similar to what i said
above.
--
Brian Coca
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8mE%3DhFVoSAKuUf8-ceo6eNB_35_fsTrRBGSXPFHyZ-%3DTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Barry Kaplan
2015-07-18 02:56:04 UTC
Permalink
Post by Brian Coca
delegate_to does not take lists, groups.control is a list,
Ah, yes. Thanks!
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a2b4a1eb-ff98-463d-b0f6-bb318b5a7e71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-18 02:59:37 UTC
Permalink
This should be fixed in 2.0 (current devel)
Post by Barry Kaplan
Post by Brian Coca
delegate_to does not take lists, groups.control is a list,
Ah, yes. Thanks!
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a2b4a1eb-ff98-463d-b0f6-bb318b5a7e71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Brian Coca
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8%3DbO0Ft-rr2XJBmLYT7c-yoMMPEWawK865ouzGg2dwoYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...