Search code examples
salt-project

SaltStack error: State *.basic found in sls test.test is unavailable


I'm trying to use Salt to deploy an online tool to a new VPS. The process involves cloning a git repo and then various set-up commands - however there seems to be an issue with including other .sls files from within sub directories.

Here's a simplified version:

Master config file:

file_roots:
  base:
    - /srv/salt/saltstates

I have a a file in /srv/salt/saltstates/test/test.sls containing:

base:
  '*':
    - basic

The file /srv/salt/saltstates/test/basic.sls contains:

Europe/London:
    timezone.system

However, when I run salt 'Minion1' state.sls test.test, an error is returned:

Minion1:
----------
          ID: base
    Function: *.basic
      Result: False
     Comment: State *.basic found in sls test.test is unavailable
     Started: 
    Duration: 
     Changes:   

Solution

  • OK, so you've confused several things here.

    First of all the contents you've put in /srv/salt/saltstates/test/test.sls really is what is called a top file and should probably be moved to /srv/salt/saltstates/top.sls The top.sls is only needed if you want to do a highstate, but since you're trying to run salt 'Minion1' state.sls test.test you don't really need the top.sls.

    Now since you have your sls file here: /srv/salt/saltstates/test/basic.sls, then the command you want to run is the following:

    salt 'Minion1' state.sls test.basic

    The "dot" traverses down directories.