name: Get physical interfaces names
command: find /sys/class/net -type l -not -lname '*virtual*' -printf '%f\n'
register: phyintcmd
changed_when: false
check_mode: false
- name: Show interfaces details
debug:
msg: "{{ lookup('vars', 'macaddress' + item) }}"
loop: "{{ phyintcmd.stdout_lines }}"
а как мне теперь имя интерфейчас и мак вытащить и вписать в lineinfile ?
вывод
TASK [Show interfaces details] *******************************************************************************************************************************************************************
ok: [5.39.219.123] => (item=enp7s0) => {
"msg": {
"active": true,
"device": "enp7s0",
"features": {
"busy_poll": "off [fixed]",
"fcoe_mtu": "off [fixed]",
"generic_receive_offload": "on",
"generic_segmentation_offload": "on",
"highdma": "on [fixed]",
"hw_tc_offload": "on",
"l2_fwd_offload": "off [fixed]",
"large_receive_offload": "off [fixed]",
"loopback": "off [fixed]",
"netns_local": "off [fixed]",
"ntuple_filters": "off",
"receive_hashing": "on",
"rx_all": "off",
"rx_checksumming": "on",
"rx_fcs": "off [fixed]",
"rx_gro_hw": "off [fixed]",
"rx_udp_tunnel_port_offload": "off [fixed]",
"rx_vlan_filter": "on [fixed]",
"rx_vlan_offload": "on",
"rx_vlan_stag_filter": "off [fixed]",
"rx_vlan_stag_hw_parse": "off [fixed]",
"scatter_gather": "on",
"tcp_segmentation_offload": "on",
"tx_checksum_fcoe_crc": "off [fixed]",
"tx_checksum_ip_generic": "on",
"tx_checksum_ipv4": "off [fixed]",
"tx_checksum_ipv6": "off [fixed]",
"tx_checksum_sctp": "on",
"tx_checksumming": "on",
"tx_fcoe_segmentation": "off [fixed]",
"tx_gre_csum_segmentation": "on",
"tx_gre_segmentation": "on",
"tx_gso_partial": "on",
"tx_gso_robust": "off [fixed]",
"tx_ipip_segmentation": "on",
"tx_lockless": "off [fixed]",
"tx_nocache_copy": "off",
"tx_scatter_gather": "on",
"tx_scatter_gather_fraglist": "off [fixed]",
"tx_sctp_segmentation": "off [fixed]",
"tx_sit_segmentation": "on",
"tx_tcp6_segmentation": "on",
"tx_tcp_ecn_segmentation": "off [fixed]",
"tx_tcp_mangleid_segmentation": "off",
"tx_tcp_segmentation": "on",
"tx_udp_tnl_csum_segmentation": "on",
"tx_udp_tnl_segmentation": "on",
"tx_vlan_offload": "on",
"tx_vlan_stag_hw_insert": "off [fixed]",
"udp_fragmentation_offload": "off [fixed]",
"vlan_challenged": "off [fixed]"
},
"hw_timestamp_filters": [
"none",
"all"
],
"macaddress": "18:31:bf:d0:69:b5",
"module": "igb",
"mtu": 1500,
"pciid": "0000:07:00.0",
"phc_index": 0,
"promisc": true,
"speed": 1000,
"timestamping": [
"tx_hardware",
"tx_software",
"rx_hardware",
"rx_software",
"software",
"raw_hardware"
],
"type": "ether"
}
}
@pro_ansible
Обсуждают сегодня