{% macro loop_hosts(group) -%} {% for h in groups[group] -%} {% set h = dict(hostvars[h]) %} {{ caller(h) }} {%- endfor %} {%- endmacro %} {% macro loop_valid_hosts(group) -%} {% for h in groups[group] -%} {% set h = dict(hostvars[h]) %} {% if h.ip.in is defined and h.ip.out is defined -%} {{ caller(h) }} {%- endif %} {%- endfor %} {%- endmacro %}