client_acl 配置使用
1.概述:开启对系统上非root的系统用户在master上可以执行特殊的模块。这些模块名可以使用正则表达式来表示,不能指定对哪些minion执行命令。执行命令只需要切换到具体的用户即可
不需要认证。
2.开启配置:
vim /etc/salt/master
client_acl:
test:
- test.ping
- cmd.*
配置解释:test用户只能执行test.ping 和cmd模块的命令
3.重启salt-master服务
service salt-mater restart
4.验证
[test@localhost salt]$ salt '*' test.ping
192.168.138.128:
True
报错总结
1.[WARNING ] Failed to open log file, do you have permission to write to /var/log/salt/master?
解决:
chmod 777 /var/log/salt/master
2.Salt request timed out. The master is not responding. If this error persists after verifying the master is up, worker_threads may need to be increased.
这里是因为master的interface的地址不是0.0.0.0 导致的。改为0.0.0.0 重启服务就不报错了,这个好像是个bug