<p>I'm trying to run the playbook</p>
<pre><code>ansible-playbook \
  -i inventory/preprod/inventory.ini \
  --private-key ~/.ssh/id_rsa_stagging \
  -u cloud-user \
  --become \
  --become-user=root \
  cluster.yml \
  --tags resolvconf
</code></pre>
<p>And it returns this error:</p>
<pre><code>fatal: [tivit-aiops-k8s-preprd-app-1]: FAILED! =&gt; {
  &quot;msg&quot;: &quot;The field 'environment' has an invalid 
  value, which includes an undefined variable. The error 
  was: 'ansible.vars.hostvars.HostVarsVars object' has 
  no attribute 'ansible_hostname'&quot;
}
</code></pre>
<p>I don't understand what I'm doing wrong ....</p>

Thiago Oliveira
<p>Take a look at the <a href="https://github.com/kubernetes-sigs/kubespray/blob/master/inventory/sample/inventory.ini" rel="nofollow noreferrer">sample inventory</a> provided from Kubespray:</p>

<pre><code># ## Configure 'ip' variable to bind kubernetes services on a
# ## different ip than the default iface
# ## We should set etcd_member_name for etcd cluster. The node that is not a etcd member do not need to set the value, or can set the empty string value.
[all]
# node1 ansible_host=95.54.0.12  # ip=10.3.0.1 etcd_member_name=etcd1
# node2 ansible_host=95.54.0.13  # ip=10.3.0.2 etcd_member_name=etcd2
# node3 ansible_host=95.54.0.14  # ip=10.3.0.3 etcd_member_name=etcd3
# node4 ansible_host=95.54.0.15  # ip=10.3.0.4 etcd_member_name=etcd4
# node5 ansible_host=95.54.0.16  # ip=10.3.0.5 etcd_member_name=etcd5
# node6 ansible_host=95.54.0.17  # ip=10.3.0.6 etcd_member_name=etcd6
</code></pre>

<p>There's a name which can be used to reference this host through the inventory file (for assigning groups to the host), and there's also an <code>ansible_host</code> value which specifies the IP that Ansible will connect to (separately from the name).</p>
