ansible-继续普通用户权限运行

ansible 远程以普通用户执行命令

 

1. ansible 10.0.0.1 -m raw -a "date" -u www

2.在ansible的主机配置文件中指定ssh_user
vi/etc/ansible/hosts
10.0.0.1 ansible_ssh_user=www

用一个例子来演示会更加清晰
 
 

ansible test-hosts -m file -a "path=/root/fstab owner=root group=root mode=600"

 https://www.cnblogs.com/trymybesttoimp/p/6223979.html

 
posted @ 2019-11-19 16:59  zhouyuqiang  阅读(1522)  评论(0编辑  收藏  举报