一个选项是使用下面的模板
{% for my_interface in ansible_interfaces %}
{% for line in lookup(‘pipe’, ‘ifconfig ‘ + my_interface) %}{{ line }}{% endfor %}
{{ ‘\n’ }}
{% endfor %}
</code>
我想从主机中提取所有接口名称,然后打印该接口的所有信息。
—#使用IP获取网络接口
- 主持人:hta
gather_facts:是的
成为:是的
…