Ansible, the field args has an invalid value
<p>I added a role called common to my playbook.yml, and provisioning fails with the message:</p>

<pre><code>TASK [common : Host is present] ************************************************
==&gt; cd: fatal: [localhost]: FAILED! =&gt; {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'unicode object' has no attribute 'host_ip'\n\nThe error appears to have been in '/vagrant/ansible/roles/common/tasks/main.yml': line 7, 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: Host is present\n  ^ here\n"}
</code></pre>

<p>here is the content of <code>roles/common/tasks/main.yml</code>, the particular tasks which fails</p>

<pre><code>- name: Host is present
  lineinfile:
    dest: /etc/hosts
    regexp: "^{{ item.host_ip }}"
    line: "{{ item.host_ip }} {{ item.host_name }}"
  with_items: hosts
  tags: [common]
</code></pre>

<p>And here is the content of <code>roles/common/defaults/main.yml</code></p>

<pre><code>hosts: [
  { host_ip: "10.100.198.200", host_name: "cd"},
  { host_ip: "10.100.198.201", host_name: "prod"},
  { host_ip: "10.100.198.202", host_name: "logging"},
  { host_ip: "10.100.194.201", host_name: "serv-disc-01"},
  { host_ip: "10.100.194.202", host_name: "serv-disc-02"},
  { host_ip: "10.100.194.203", host_name: "serv-disc-03"},
  { host_ip: "10.100.193.200", host_name: "proxy"},
  { host_ip: "10.100.192.200", host_name: "swarm-master"},
  { host_ip: "10.100.192.201", host_name: "swarm-node-1"},
  { host_ip: "10.100.192.202", host_name: "swarm-node-2"},
]

obsolete_services:
  - puppet
  - chef-client
</code></pre>

<p>Why ansible claims that args is undefined. The example I'm using is not made by me and is few months old, so I wonder, if the way ansible processes variables in roles has changed, and thus it doesn't work.</p>