admin
不忘初心,方得始终
级别: 管理员
只看楼主 | | | 0楼 发表于:2018-01-18 09:06

ansible命令查看服务器硬件信息

  1.查看服务器IPMI IP地址的命令为:#ipmitool lan print |grep "IP"|grep -v 'Source'|grep -v 'Gateway'|grep -v 'Header'|awk -F  ' ' '{print $4}'
   批量查看服务器IPMI的IP地址的命令为:#ansible -i node.txt all -m shell -a "ipmitool lan print |grep "IP"|grep -v 'Source'|grep -v 'Gateway'|grep -v 'Header'|awk -F  ' ' '{print $4}'" >> ipmi_ip.txt
  
  2.查看服务器ipmi MAC地址的命令为:#ipmitool lan print |grep MAC|grep -v Gateway|awk -F ' ' '{print $4}'
  批量查看服务器IPMI MAC地址的命令为:ansible -i node.txt all -m shell -a "ipmitool lan print |grep MAC|grep -v Gateway|awk -F ' ' '{print $4}'"
  
  3.查看服务器IP地址的命令为: ifconfig em1|grep ether|awk -F ' ' '{print $2}
  批量查看服务器网卡IP地址的命令为:ansible -i node.txt all -m shell -f 1 -a "ifconfig em1|grep ether|awk '{print \$2}'">> em1_mac.txt

  4.