Hi all,

I'm building an HTML report based on a template that looks something like 
this:

{% for i in ansible_play_hosts %}
  <tr>
    <td class="tg-o8wf">{{ i }}</td>
    <td class="tg-o8wf">{{ hostvars[i].ansible_os_name }}</td>
    <td class="tg-o8wf">{{ hostvars[i].ansible_distribution }}</td>
    <td class="tg-o8wf">{{ hostvars[i].ansible_env.NUMBER_OF_PROCESSORS 
}}</td>
...
...

In case one of the hosts is unreachable, template is not being generated 
and the following error is being generated:

TASK [xxx] *************************************
task path: /etc/ansible/playbooks/xxx.yml:6
fatal: [xxx -> localhost]: FAILED! => {"changed": false, "failed": true, 
"invocation": {"module_args": {"dest": "/etc/ansible/playbooks/xxx.txt", 
"src": "/etc/ansible/playbooks/xxx.j2"}, "module_name": "template"}, "msg": 
"AnsibleUndefinedVariable: 'dict object' has no attribute 'ansible_env'"}
...ignoring

Any idea how to overcome this? Skip the unreachable host but do 
successfully generate "dest" file?

Thanks,

-- 
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/146a631d-fd64-44a1-b58e-788d3ffb70df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to