在Jinja模板中回答多个事实


无语
2025-03-25 01:31:23 (1天前)


我想从主机中提取所有接口名称,然后打印该接口的所有信息。

—#使用IP获取网络接口
- 主持人:hta
gather_facts:是的
成为:是的


2 条回复
  1. 0# 无思 | 2019-08-31 10-32



    一个选项是使用下面的模板




    1. {% for my_interface in ansible_interfaces %}
      {% for line in lookup(‘pipe’, ifconfig + my_interface) %}{{ line }}{% endfor %}
      {{ \n }}
      {% endfor %}

    2. </code>

登录 后才能参与评论