Search code examples
thruk

Thruk - templating - Add href when host is member of hostgroup


In the _block.tt its possible to add href when custom_vars_host is present.

[% IF custom_vars_host.size > 0 %]
[% FOREACH cust = custom_vars_host %]
[% IF cust.key == "ilo" || cust.key == "drac") %]
<td><a href='https://[% cust.value %]/'>...</a></td>
[% END %]
[% END %]
[% END %]

Is there a way to add link when host is member of a hostgroup?


Solution

  • Same way as the macro

    [% IF host.groups.size > 0 %]

    [% FOREACH group IN host.groups.sort %]

    [% IF group == "metrics-win" %]

    [% END %]

    [% END %]

    [% END %]