Hi there! I have some troubles with vars in ansible... What i have: [root@ansible ansible]# cat /etc/ansible/roles/preconf/tasks/main.yml - name: installing pkg apt: pkg=$item with_items: - htop - sudo - tcpdump - mc - wget - vim - facter
- name: Add users # user: name={{item.user}} comment={{item.comment}} uid={{item.uid}} password={{item.password}} shell='/bin/bash' groups='sudo' debug: msg={{item.user}} msg={{item.comment}} msg={{item.uid}} msg={{item.password}} with_items: - $adm_users [root@ansible ansible]# cat /etc/ansible/roles/main/variables/main.yml adm_users: - { user: 'user1', comment: 'user11', uid: '15139', password: '$gsdJDGASgdashdakshdg' } - { user: 'user2', comment: 'user22', uid: '15217', password: '$tERuJGEAgdfSAGDVaGV' } What i do: [root@ansible ansible]# time ansible-playbook -vvvv main.yml --ask-pass --ask-sudo-pass Using /etc/ansible/ansible.cfg as config file SSH password: SUDO password[defaults to SSH password]: 1 plays in main.yml Loaded callback default of type stdout, v2.0 PLAY *************************************************************************** TASK [setup] ******************************************************************* ... ok: [192.168.0.2] TASK [preconf : installing pkg] ************************************************ ... ok: [192.168.0.2] => (item=[u'htop', u'sudo', u'tcpdump', u'mc', u'wget', u'vim', u'facter']) => {"cache_update_time": 0, "cache_updated": false, "changed": false, "invocation": {"module_args": {"name": ["htop", "sudo", "tcpdump", "mc", "wget", "vim", "facter"]}, "module_name": "apt"}, "item": ["htop", "sudo", "tcpdump", "mc", "wget", "vim", "facter"]} TASK [preconf : Add users] ***************************************************** task path: /etc/ansible/roles/preconf/tasks/main.yml:12 fatal: [192.168.0.2]: FAILED! => {"failed": true, "msg": "ERROR! 'unicode object' has no attribute 'password'"} PLAY RECAP ********************************************************************* 192.168.0.2 : ok=2 changed=0 unreachable=0 failed=1 real 0m3.745s user 0m0.357s sys 0m0.100s Ansible version: ansible 2.0.0.2 (stable-2.0.0.1 7de237c5a1) last updated 2016/01/16 10:27:31 (GMT +500) lib/ansible/modules/core: (detached HEAD ce6619bf5d) last updated 2016/01/16 10:27:57 (GMT +500) lib/ansible/modules/extras: (detached HEAD 29af26884e) last updated 2016/01/16 10:28:02 (GMT +500) config file = /etc/ansible/ansible.cfg configured module search path = Default w/o overrides What i'm doing wrong? -- 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/fb070460-9f56-4a08-8c18-1127cab044ca%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.