Executing arbitrary sls file with salt

saltstack

I'm learning about salt.

I understand that the way things work, state files must be put under a root directory specified statically in the master/minion config.

So my question is, is there a way to execute an arbitrary sls file on the filesystem, i.e. not under the configured file roots?

The purpose of this, is that I want my projects to include sls files describing the required state of the system on which they will be deployed, and ideally I'd like not to have to copy/symlink those files into the salt file root.

Thanks!

Best Answer

No, salt looks for state files in file_roots. You tell it which sls to execute by giving it a dot separated name, e.g. salt '*' state.apply my.state which salt will look for in /srv/salt/my/state.sls or /srv/salt/my/state/init.sls by default.

The files need to be present on the salt master (unless you are using minion in masterless mode).