互联网服务Ansible

ansible中如何获取主机清单中组的ip地址?

参与3

1同行回答

jayciededejayciedede  技术经理 , 安图特(北京)科技有限公司
shell: "ping -c 1 {{item}} | grep icmp_seq | gawk -F'[()]' '{print $2}'"with_inventory_hostnames: test2register: testipdebug: "msg={{ item.stdout }}"with_items: "{{ testip.results }}"显示全部
  • shell: "ping -c 1 {{item}} | grep icmp_seq | gawk -F'[()]' '{print $2}'"

with_inventory_hostnames: test2

register: testip

  • debug: "msg={{ item.stdout }}"

with_items: "{{ testip.results }}"

收起
互联网服务 · 2019-12-27
浏览2589

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2019-12-27
  • 关注会员:2 人
  • 问题浏览:3270
  • 最近回答:2019-12-27
  • X社区推广