ansible根据密码sudo执行命令需求分析主机当前在同一个局域网访问权限方面:禁止所有主机使用root直接登录所有主机禁止配置密钥登录所有主机sudotoroot权限ssh登录端口为65535实战计划installansibleyum-yinstallansibleclosehost_key_checkingvim/etc/ansible/ansible.cfghost_key_checking=Falseconfigurehostsvim/etc/ansible/hosts[centos6]192.168.22.1:22ansible_ssh_user=wanghuiansible_ssh_='123456'ansible_sudo_pass='123456'[centos7]centos7-node1.abc.com:22ansible_ssh_user=wanghuiansible_ssh_pass='123456'ansible_sudo_pass='123456'-执行命令an-a"mkdir/root/test-p"-uwanghui--sudo还有一个hosts文件配置直接用root和密码执行[centos-all]centos7-node1ansible_ssh_host=192.168.56.11ansible_ssh_port=22ansible_ssh_user=rootansible_ssh_pass='111'centos7-node2ansible_ssh_host=192.168.56.12ansible_ssh_port=22ansible_ssh_user=rootansible_ssh_pass='111'
