Hi Dan,

1. If you use a quote at the start, you should close it only at the end. So 
this should work:

  when: "{{ item['status'] }} == 'enabled'"

2. In line above, you don't need {{ and thus quotes, when using when: 'always 
use {{ }} except when 
when:'<http://docs.ansible.com/ansible/faq.html#when-should-i-use-also-how-to-interpolate-variables-or-dynamic-variable-names>

3. You are missing "testusr" when accessing an item's elements, or better said, 
"testusr" part in var definition is an extra.
This would work better:

        "user_accounts": [
          {
            "gecos": "Test User",
            "grp": "wheel",
            "pass": "123abc",
            "status": "enabled",
            "username": "testusr"
          }
        ]

If you really need "testusr" data, you could put it as an additional element:

        "user_accounts": [
          {

            "id": "testusr",

            "gecos": "Test User",
            "grp": "wheel",
            "pass": "123abc",
            "status": "enabled",
            "username": "testusr"
          }
        ]

So, with the variable declared as above, this would be a cleaner way to 
accomplish what you want:
  when: item.status == 'enabled'

Cheers,
Marko


______________________________________________________________________________________________________

CONFIDENTIALITY NOTICE:  This message is the property of International Game 
Technology PLC and/or
its subsidiaries and may contain proprietary, confidential or trade secret 
information.
This message is intended solely for the use of the addressee. If you are not 
the intended recipient
and have received this message in error, please delete this message from your 
system. Any unauthorized
reading, distribution, copying, or other use of this message or its attachments 
is strictly prohibited.

-- 
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/1485872984416.18667%40IGT.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to