############################################################
*
* SaltStack远程分发DNS配置文件
############################################################
[[email protected] srv]# mkdir -p /srv/salt/dns/files
[[email protected] srv]# cp /etc/resolv.conf /srv/salt/dns/files/
#分发/etc/resolv.conf相关的配置文件
[[email protected] dns]# tree /srv/salt/dns/
/srv/salt/dns/
├── dns-install.sls
└── files
└── resolv.conf
[[email protected] dns]# cat /srv/salt/dns/dns-install.sls
/etc/resolv.conf:
file.managed:
- source: salt://dns/files/resolv.conf
- user: root
- group: root
- mode: 644
[[email protected] srv]# cat /srv/salt/dns/files/resolv.conf
nameserver 192.168.44.2
#salt-v11
#服务端执行命令
salt ‘WEB0?‘ state.sls dns.dns-install
#全局配置
[[email protected] dns]# cat /srv/salt/top.sls
base:
‘*‘:
- apache.apache-install
- dns.dns-install
#测试执行,没问题才更新到客户端
[[email protected] salt]# salt ‘WEB01‘ state.highstate test=True
原文地址:http://blog.51cto.com/yehaixiao/2125092