[root@361way.com ~]# cat /etc/ansible/hosts [test01] 10.212.52.14 ansible_ssh_user=test ansible_ssh_pass=111111 ansible_su_pass=*I2145 10.212.52.16 ansible_ssh_user=test ansible_ssh_pass=xyz123 ansible_su_pass=mn1Pokm 10.212.52.252 ansible_ssh_user=amos ansible_ssh_pass=asdf ansible_su_pass=xyzp)okm
ansible_su_pass变量输入root账户密码,当ansible执行root命令时,可以不输入密码,直接执行