草庐IT

Asible 批量跑出服务器相关信息

1、定义剧本(我这里只输出序列号)[root@libin3]#catlibin.yml-hosts:taskgather_facts:notasks:-name:fetchshell:|dmidecode-t1|grep"SerialNumber"|awk-F":"'{print$2}'register:serial-name:ddshell:|echo"{{serial.stdout}},{{inventory_hostname}}">>libin.csvdelegate_to:localhost2、定义清单[root@libin3]#cathosts[task]ip地址[task:vars

Asible 批量跑出服务器相关信息

1、定义剧本(我这里只输出序列号)[root@libin3]#catlibin.yml-hosts:taskgather_facts:notasks:-name:fetchshell:|dmidecode-t1|grep"SerialNumber"|awk-F":"'{print$2}'register:serial-name:ddshell:|echo"{{serial.stdout}},{{inventory_hostname}}">>libin.csvdelegate_to:localhost2、定义清单[root@libin3]#cathosts[task]ip地址[task:vars