0
{% 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!

Aswin
  • 19
  • 4
  • I am new to ansible. What does pipe (`|`), difference and source_ip are? Could you state in ordinary english (not in ansible), what data you have and what you need to get? – Draco Ater May 07 '20 at 08:44

1 Answers1

0

you can use template resource with embedded-ruby (erb)

Mr.
  • 9,429
  • 13
  • 58
  • 82