title: Ansible variable check in playbook
body: <p>I have in the vars file the databases configured as the following:</p>
  
  <pre><code>project_dbs:
    - { project_db_name: "project1", project_db_user: "user", tenon_db_password: "pass" }
    - { project_db_name: "project2",  project_db_user: "dev", tenon_db_password: "pass2"}
    - { project_db_name: "project3", project_db_user: "{{datadog_mysql_username}}", project_db_password: "{{datadog_mysql_password}}" }
  </code></pre>
  
  <p>Now in a playbook I have a check:</p>
  
  <pre><code> - name: copy config.json template to server
     tags: provision
     template: src=config.json dest={{ project_root }}/config
     when: item.project_db_name == "project2"
     with_items: project_dbs
  </code></pre>
  
  <p>But the when check is failing. Any idea how to make that work?</p>
  
  <p>The error message looks like this:</p>
  
  <blockquote>
    <p>fatal: [test]: FAILED! => {"failed": true, "msg": "The conditional check 'item.projects_db_name == \"project2\"' failed. The error was: error while evaluating conditional (item.projects_db_name == \"project2\"): 'unicode object' has no attribute 'projects_db_name'\n\nThe error appears to have been in '/var/lib/jenkins/project/ansible/roles/project2/tasks/main.yml': line 28, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: copy config.json template to server\n  ^ here\n"}</p>
  </blockquote>