Hello,

I'm unable to get the "looping over subelements" example on this page:
http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-subelements

to work.  Specifically, when I copy-and-paste "users" into my file 
"group_vars/test" and attempt to run:

- debug:
    msg:
    - "{{ item.0.name }}"
    - "{{ item.0.mysql.password }}"
    - "{{ item.1 }}"
    - "{{ item.0.mysql.privs | join('/') }}"
  with_subelements:
    - "{{ users }}"
    - "{{ mysql.hosts }}"

ansible-playbook reports:

[DEPRECATION WARNING]: Skipping task due to undefined Error, in the future 
this will be a fatal error.: 'mysql' is undefined.
This feature will be removed in a future
release. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File 
"/opt/Python-2.7.6/lib/python2.7/site-packages/ansible/executor/task_executor.py",
 
line 91, in run
    items = self._get_loop_items()
  File 
"/opt/Python-2.7.6/lib/python2.7/site-packages/ansible/executor/task_executor.py",
 
line 191, in _get_loop_items
    items = self._shared_loader_obj.lookup_loader.get(self._task.loop, 
loader=self._loader, templar=templar).run(terms=loop_terms, 
variables=self._job_vars, wantlist=True)
  File 
"/opt/Python-2.7.6/lib/python2.7/site-packages/ansible/plugins/lookup/subelements.py",
 
line 37, in run
    terms[0] = listify_lookup_plugin_terms(terms[0], templar=self._templar, 
loader=self._loader)
IndexError: list index out of range

fatal: [imdb410a.unx.sas.com]: FAILED! => {"failed": true, "msg": 
"Unexpected failure during module execution.", "stdout": ""}


I don't want to set up any mysql users.  I want an example to work with 
because I want to use a similar data structure in our playbooks.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to