saltstack cp - copy files or directory

[size=x-small]saltstack 学习之cp模块[/size]
【基本介绍】
这里简单介绍cp模块,cp实现文件的推送和拉取。

【基本配置】
[b]cp.push - 获取minion的文件到master机器[/b]
Push a file from the minion up to the master, the file will be saved to the salt master in the master's minion files cachedir (defaults to /var/cache/salt/master/minions/minion-id/files)
Since this feature allows a minion to push a file up to the master server it is disabled by default for security purposes. To enable, set file_recv to True in the master configuration file, and restart the master.
配置支持从minion拉取文件,并配置cache目录。

# Allow minions to push files to the master. This is disabled by default, for
# security purposes.
file_recv: True

# Directory to store job and cache data:
cachedir: /var/cache/salt/master

[code="linux"]
# salt xxx cp.push /usr/local/scripts/cut_nglog.sh
xx:
True
# ls -l /var/cache/salt/master/minions/xxx/files/usr/local/scripts/cut_nglog.sh
-rw-r--r-- 1 root root 2099 Oct 15 18:05 /var/cache/salt/master/minions/xxx/files/usr/local/scripts/cut_nglog.sh
[/code]

cp.push_dir拉取minion上的目录到master上面,类似cp.push

[b]file.get_file - 推送master的文件到minion机器[/b]
Used to get a single file from the salt master

[code="linux"]
# salt xxx cp.get_file salt://xx.sls /root/ttt
xxx:
/root/ttt
# ls -l /root/ttt
-rw-r--r-- 1 root root 29 Oct 15 18:14 /root/ttt
[/code]

类似于salt-cp
salt-cp '*' [ options ] SOURCE DEST
[code="linux"]
# salt-cp xxx /root/salt/nagios.log /root/ttt
{'xxx': {'/root/ttt': True}}
[/code]
【其他模块】
其他模块参照[url]http://salt.readthedocs.org/en/latest/ref/modules/all/salt.modules.cp.html#salt.modules.cp.get_file[/url]

【参考引用】
[url]http://rfyiamcool.blog.51cto.com/1030776/1360468[/url]
[url]https://salt.readthedocs.org/en/v0.17.1/ref/cli/salt-cp.html[/url]
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值