Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SaltStack: getting No top file or master_tops data matches found

I am new to SaltStack and following some tutorials and trying to execute state.apply but getting below error:

# salt "host2" state.apply 
host2:
----------
          ID: states
    Function: no.None
      Result: False
     Comment: No Top file or external nodes data matches found
     Started: 
    Duration: 
     Changes:   

Summary for host2
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1

I am able to test.ping successfully to host. here is directory structure:

/etc/salt/srv/salt/states
                     |-top.sls
                     |-installations
                           |-init.sls

file root entry in master config

file_roots:   
  base:
    - /srv/salt/states

top.sls ->

base:
  '*':
    - installations

init.sls->

install_apache:
  pkg.installed:
    - name: apache2
like image 700
Dhiman S. Avatar asked Oct 02 '18 07:10

Dhiman S.


2 Answers

You need to change the path to your states, or move them to the path set in file_roots.

The file_roots option is where you should place your files, you should have the following tree:

# tree /srv/salt/
/srv/salt/
|-- installations
    `-- init.sls
`-- top.sls

Or you could change your file_roots, but I wouldn't do it, since /srv/salt/ seems to be a sort of "standard".

Have a look at the tutorials, if you haven't already: https://docs.saltstack.com/en/getstarted/fundamentals/

like image 76
Alberto Chiusole Avatar answered Oct 17 '22 08:10

Alberto Chiusole


I changes the

file_root:    
  base:
    - /etc/salt/srv/salt/state

and it works for me. looks it wasn't picking path correctly

like image 36
Dhiman S. Avatar answered Oct 17 '22 08:10

Dhiman S.