ansible 普通用户执行root权限 su,ansibleroot
ansible 普通用户执行root权限 su,ansibleroot
[root@web-10 ~]# ansible -i /etc/ansible/hosts rt01 -s -m shell -a "netstat -tunpl"
加-s
hosts配置文件添加ansible_su_pass
10.0.0.177 ansible_ssh_pass=xxxxx ansible_su_pass=xxxx
[root@web-10 ~]# ansible -i /etc/ansible/hosts rt01 -s -m shell -a "netstat -tunpl"
加-s
hosts配置文件添加ansible_su_pass
10.0.0.177 ansible_ssh_pass=xxxxx ansible_su_pass=xxxx
评论暂时关闭