方案1:
ansible -m ping -u 用户名
方案2:
修改/etc/ansible/hosts文件:
[test_hosts] host_ip ansible_user=用户名
# 还可以指定登陆密码
host_ip ansible_user=用户名 ansible_ssh_pass=登陆密码
方案1:
ansible -m ping -u 用户名
方案2:
修改/etc/ansible/hosts文件:
[test_hosts] host_ip ansible_user=用户名
# 还可以指定登陆密码
host_ip ansible_user=用户名 ansible_ssh_pass=登陆密码