SaltStack 之 salt-cp 文件复制替换实践
一、我们把/srv/salt/files/hosts 文件复制到各从机的的/root下
[[email protected] srv]# salt-cp ‘*‘ /srv/salt/files/hosts /root/
{‘BackupServer‘: {‘/root/hosts‘: True},
‘GZ15_ZABBIX‘: {‘/root/hosts‘: True},
‘GZIFC_ZABBIX‘: {‘/root/hosts‘: True},
‘GZXB_ZABBIX‘: {‘/root/hosts‘: True},
‘SHJM_ZABBIX‘: {‘/root/hosts‘: True},
‘SZPA_ZABBIX‘: {‘/root/hosts‘: True}}
二、查看各主机是否有该文件存在
[[email protected] srv]# salt ‘*‘ cmd.run ‘ls -l /root/ | grep hosts‘
GZIFC_ZABBIX:
-rw-r--r-- 1 root root 308 Jun 9 20:28 hosts
BackupServer:
-rw-r--r-- 1 root root 308 Jun 9 20:28 hosts
SZPA_ZABBIX:
-rw-r--r--. 1 root root 308 Jun 9 20:28 hosts
GZXB_ZABBIX:
-rw-r--r-- 1 root root 308 Jun 10 04:32 hosts
GZ15_ZABBIX:
-rw-r--r--. 1 root root 308 Jun 9 20:30 hosts
SHJM_ZABBIX:
-rw-r--r-- 1 root root 308 Jun 9 20:31 hosts
原文地址:http://blog.51cto.com/12965094/2126795
时间: 2024-10-14 01:55:12