You may have a typo or 2 in your sample case. This works fine for me:

$ cat tst.yml
---
- hosts: localhost
  vars:
        staff:
          - { netid: user001, uid: 12345, comment: "Chris Short", state: 
present }
          - { netid: user002, uid: 12346, comment: "Bob Jones", state: 
absent }

  tasks:

    - name: Do Something
      shell: "echo 'present: {{ item.netid }}'"
      with_items:
        - "{{ staff }}"
      when: item.state == 'present'
$ ansible-playbook tst.yml

PLAY 
***************************************************************************

TASK [setup] 
*******************************************************************
ok: [localhost]

TASK [Do Something] 
************************************************************
changed: [localhost] => (item={u'comment': u'Chris Short', u'state': 
u'present', u'uid': 12345, u'netid': u'user001'})
skipping: [localhost] => (item={u'comment': u'Bob Jones', u'state': 
u'absent', u'uid': 12346, u'netid': u'user002'})

PLAY RECAP 
*********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0

-- 
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/21c874cc-064b-41fd-b8f8-2d18fd24dae6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to