2016-09-09 57 views

回答

2

我知道这样说:

- hosts: localhost 
    vars: 
    eth_to_use: en0 
    tasks: 
    - debug: msg="{{hostvars[inventory_hostname]['ansible_'+eth_to_use].ipv4[0].address}}" 
+0

不错,如果通过IPv4的 –

+0

@NelsonG'ipv4' [0]取代IPv4作品这里是一个列表,所以你不能只调用'ipv4.address' –

相关问题