View file contents on a Salt Stack minion
Solution 1:
Solution using cmd.run
module:
salt '*' cmd.run 'cat /path/to/file'
Solution 2:
Get the contents of a file without using external commands:
sudo salt '*' cp.get_file_str file:///etc/hosts
Solution 3:
This feature was added on a later version of Salt, you can find it in the salt official documentation on this link.
You can push a file from a salt minion to the master by issuing this command:
salt '*' cp.push /path/to/file
Keep in mind that you need to enable it on the salt master configuration file before by setting the file_recv
option to True