Name active interface

{% set i = salt['network.routes']('inet')|length %}
{% for n in range(i) %}
{% set interface_name = salt['network.routes']('inet')[n]['interface'] %}
echo_{{ interface_name }}:
  cmd.run:
    - name: echo {{ interface_name }}
{% endfor %}

Last updated