ansible指定用户

方案1:

ansible -m ping -u 用户名

 

方案2:

修改/etc/ansible/hosts文件:

[test_hosts]
host_ip ansible_user=用户名

# 还可以指定登陆密码
host_ip ansible_user=用户名 ansible_ssh_pass=登陆密码

 

posted @ 2022-07-01 13:42  Shiyu_Huang  阅读(2003)  评论(0编辑  收藏  举报