#!/bin/bash ssh_hosts=("IP" "IP1".......) user=root remote_cmd="df -h" port=22 for ip in ${ssh_hosts[*]} do ssh -t $user@$ip $remote_cmd done 其中remote_cmd改成你想执行的命令,其中控制机和被执行命令的机器做了免秘钥登录…
yum install -y ansible 编辑 /etc/ansible/hosts 文件 # This is the default ansible 'hosts' file.## It should live in /etc/ansible/hosts## - Comments begin with the '#' character # 用#来表示注释# - Blank lines are ignored # 空白行被忽略# - Groups of hosts are delimite…