Background: I have been working on setting up a salt-environment, and reached the point where I want to distribute not only files, but also directories. I've found that the most sensible way to do this is to place the directory I want copied in /srv/salt/path_to_dir
on the master, and then use the cp.get_dir command to distribute it.
What I have done: To test the setup and command I created /srv/salt/tmp/foo
and placed two files in it. Then when I run the command salt minion_name cp.get_dir salt://tmp/foo /tmp/foo
on the master there is one line of output that reads exactly minion_name:
. Somewhat strange that there is no output except the minion name, even error, but ok, I go to check the minion to see if anything has happened.
On the minion it has not appeared in /tmp/
, and there is no new content in /etc/salt/
or /var/cache/salt/
either. I checked in /var/log/salt/minion
, but there is nothing except my hour old attempts at figuring out why I couldn't use file.copy
with recursion set to true for distributing files.
My question(s): Is there anything obvious that I have done wrong? According to the documentation I found what I have done should work. There doesn't seem to be any error output either. Should I try using a different command or approach to distribute folders with content from the master through salt instead?
Additional information: Both the master and all the minions are Debian-systems. The installed versions of salt are salt 2014.1.3 (Hydrogen)
on the master and salt-minion 0.17.5
and salt-minion 2015.5.3
on the minions I have tried this approach with.
Best Answer
I'm not sure how you can do this using modules, I tried the same ones you did and had the same results, so possibly a bug, but if you want to set up an sls state you can use the file.recurse functionality, it looks like this:
as reference I'm using:
/srv/salt/test1/init.sls
as my sls file,test1
is the src directorytestdir
/test
init.sls
from that point you can