ansible -i /etc/ansible/conf all -S -R root -m shell -a “hostname”

默认配置位置

etc/ansible/hosts

host组格式


[group1]
192.168.40.142 ansible_ssh_user=‘root’ ansible_sudo_pass=‘密码’ ansible_ssh_pass=‘密码’ ansible_su_pass=‘密码’



[data-group01]
192.168.1.1 ansible_ssh_user=guestXXX ansible_ssh_pass=‘123456’ ansbile_sudo_pass=‘123456’ ansible_su_pass=‘123456’


ansible系列: hosts配置文件_ansible