Role default vars not being read?

I’ve got a role I’m using for testing, but I seem to be stumbling at the first hurdle.

My embryonic playbook looks like this:

`

not sure why you expect those vars to be part of host, your definition
makes them accessible like this:

{% for host in shinken_hosts %}
define host{
  use generic-host
  host_name {{ host.name }}
  address {{ host.address }}
  alias {{ host.name }}
  check_command {{ check_command }}
  _SSHPORT {{ ssh_port }}
  contacts {{ contacts }}
}
{% endfor %}

which is different from how you define them in the shinken_hosts

I think you want:
{% for host in shinken_hosts %}
define host{
  use generic-host
  host_name {{ host.name }}
  address {{ host.address }}
  alias {{ host.name }}
  check_command {{ host.check_command|default(check_command) }}
  _SSHPORT {{ host.ssh_port|default(ssh_port) }}
  contacts {{ host.contacts|default(contacts) }}
}
{% endfor %}

That’s the puppy!

Thanks for the insight. That template syntax doesn’t seem to be documented anywhere that I can see. Might be useful if it was…

Thanks

Jerry

The templates are jinja2, you can find the documentations at
http://jinja.pocoo.org/docs/dev/