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.



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).


Turns out I can kinda do what I want a few ways: 1. using the state.template function, I can specify the path to a sls template file to execute 2. In masterless mode, using salt-call with --file-root and --pillar-root arguments, I can set the file root and pillar root to any directory(but then it has to follow the file/pillar root directory structure, and have a top.sls file, unless I use state.sls).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.