Search code examples
salt-project

Using formulas with saltstack


I'm new on saltstack and I want to install postgres or apache or anyting else by using saltstack formulas.

I downloaded repo from git with

git clone https://github.com/saltstack-formulas/apache-formula.git

and

git clone https://github.com/saltstack-formulas/postgres.git

to my /srv/salt directory.

After that I added the lines

file_roots:
base:
      - /srv/salt
      - /srv/formulas/apache-formula
      - /srv/formulas/postgres

in /etc/salt/master file.

Then i created a file top.sls in the folder /srv/salt with the content:

include:
   - apache

To run this im using

salt '*' state.highstate

and all i get is the error message:

xxx.yyyyyyy.com:
----------
      ID: states
Function: no.None
  Result: False
 Comment: No Top file or external nodes data matches found
 Changes:   

Summary
------------
Succeeded: 0
Failed:    1
------------
Total:     1

What did i wrong? I read the manual on http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html but this manual doesn't help at all!


Solution

  • You have to tell salt to whom the state applies in your top.sls file:

    include:
      - apache
    
    base:
       '*':
           - apache
    

    Update: As Utah_Dave points out, I overlooked that you had the formula added to file_roots, you don't need the include directive. Just do this:

    base:
       '*':
           - apache