Hi,
Earlier today on irc I heard that the snippet below not working might be
a bug. Being new to Ansible and not wanting to waste the developers time
I'd appreciate a confirmation that this is indeed a bug before filing it.
---
- hosts: localhost
gather_facts: no
vars:
my_users:
- usr: patrick
base: /home/
- usr: nonexistinguser
base: /home/
my_dirs:
- dir1
- dir1/dir2/dir3
tasks:
- name: check if my_users exist
shell: /usr/bin/getent passwd {{item.usr}} | /usr/bin/wc -l | tr
-d ' '
register: user_exists
with_items:
- "{{my_users}}"
- name: create dirs in my_user's home
file:
dest: "{{item.item.base}}{{item.item.usr}}/{{item[1]}}"
owner: "{{item.item.usr}}"
group: "{{item.item.usr}}"
mode: 0755
state: directory
recurse: yes
with_nested:
- "{{user_exists.results}}"
- "{{my_dirs}}"
# when: item.stdout == "1"
TASK [create dirs in my_user's home] **************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "'list object'
has no attribute 'item'"}
If it's not a bug then I'd love to hear how to make this work (including
with when:... enabled).
Thanks,
Patrick
--
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/8a4fa302-5361-a3bf-73e0-71fd5b0a61d8%40laimbock.com.
For more options, visit https://groups.google.com/d/optout.