Loop and difference in chef template

44 Views Asked by At
{% for peer_ip in all_ips.split(',') | difference([source_ip]) %}
    {{ peer_ip }}
    {% endfor %}

Where source ip is the ip address of the server where this is run and peer ip is the secondary ip for the same service. all_ips contains 2 ips of source and peer comma separated.

Like this ansible code, how do i write something similar for chef template erb as I am very new to chef.

Please direct me if there is a similar question out there, couldn't find much in my limited time

Thanks a lot!

1

There are 1 best solutions below

0
On