Gatschet
Gatschet

Reputation: 1537

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!

Upvotes: 3

Views: 5079

Answers (2)

edhgoose
edhgoose

Reputation: 936

This might not be useful for your specific case, but I found that the problem I had was that I'd defined my gitfs_root to be a subfolder. This allowed us to structure an internal repo to have different subfolders for states and pillars.

When I setup my first formula, the gitfs_root meant none of the formulas worked because it was looking in the subfolder for each one.

I instead moved the config to the specific repo.

Before:

gitfs_root: salt

gitfs_remotes:
    - https://github.com/this-is/saltstack-formula
    - https://github.com/internal/salt-repo

After:

# gitfs_root:

gitfs_remotes:
    - https://github.com/this-is/saltstack-formula
    - https://github.com/internal/salt-repo
        - root: salt

Upvotes: 1

user3088543
user3088543

Reputation:

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

Upvotes: 7

Related Questions