Hello,
I try to understand how works looping overs subelements, after reading this
loops_subelements
<http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-subelements>
I
had copy & past the example and he doesn't work :
TASK: [dbtier | debug msg="name={{ item.0.user }} password={{
item.0.mysql.password }} host={{ item.1 }} priv={{ item.0.mysql.privs |
join('/') }}"] ***
fatal: [srv-lbn-tux5] => could not find 'mysql.hosts' key in iterated item
'{'authorized': ['/tmp/alice/onekey.pub', '/tmp/alice/twokey.pub'], 'name':
'alice', 'mysql': {'password': 'mysql-password', 'hosts': ['%',
'127.0.0.1', '::1', 'localhost'], 'privs': ['*.*:SELECT', 'DB1.*:ALL']}}'
FATAL: all hosts have already failed -- aborting
my tasks:
- debug: msg="name={{ item.0.user }} password={{ item.0.mysql.password }}
host={{ item.1 }} priv={{ item.0.mysql.privs | join('/') }}"
with_subelements:
- users1
- mysql.hosts
tags: debug
vars_file:
users1:
- name: alice
authorized:
- /tmp/alice/onekey.pub
- /tmp/alice/twokey.pub
mysql:
password: mysql-password
hosts:
- "%"
- "127.0.0.1"
- "::1"
- "localhost"
privs:
- "*.*:SELECT"
- "DB1.*:ALL"
- name: bob
authorized:
- /tmp/bob/id_rsa.pub
mysql:
password: other-mysql-password
hosts:
- "db1"
privs:
- "*.*:SELECT"
- "DB2.*:ALL"
Ansible version:1.9.2
Can you explain me why ?
--
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/a8b12294-61ae-494d-b4e6-a9da11d71a51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.