CentOS 7
Ads

Salt : Use Salt-cp
2016/10/16
 
It's possible to copy files to Minions with Salt command though, but it's more easy to cooy files to Minions with Salt-cp command.
[1] Use Salt-cp command.
# copy test.txt under the current directory into /root/ on all Minions

[root@dlp ~]#
salt-cp '*' test.txt /root/test.txt

{'node01.srv.world': {'/root/test.txt': True},
'node02.srv.world': {'/root/test.txt': True}}
# specify node01.srv.world for target Minion and copy

[root@dlp ~]#
salt-cp 'node01.srv.world' setup.sql /tmp/setup.sql

{'node01.srv.world': {'/root/test.txt': True},
'node02.srv.world': {'/root/test.txt': True}}
# specify target Minions with expression

[root@dlp ~]#
salt-cp -E 'node[0-9][1-2].srv.world' setup.sql /tmp/setup.sql

{'node01.srv.world': {'/tmp/setup.sql': True},
'node02.srv.world': {'/tmp/setup.sql': True}}
.....
.....
# specify Minions with Grains Data

[root@dlp ~]#
salt-cp -G 'os:CentOS' config.sh /tmp/config.sh

{'node01.srv.world': {'/tmp/config.sh': True},
'node02.srv.world': {'/tmp/config.sh': True}}
.....
.....
 
Tweet