Gareth Jeanne
Gareth Jeanne

Reputation: 1420

Unable to apply State files on Salt

Having issues applying state files to minions on salt, they're just basic test ones, nothing complicated.

In my master config file I have the following file roots definition:

file_roots:
  base:
    - /srv/salt/

My /srv/salt/top.sls file looks like this:

base:
  '*':
    - vim

Then at /srv/salt/vim/init.sls I have the following:

vim:
  pkg.installed

So, that should be applied to all minions when applied, so I run the following:

sudo salt '*' state.apply

I get the following output, and it's not applied, as it seems to not be detecting the top.sls file?

salt-master-1:
----------
          ID: states
    Function: no.None
      Result: False
     Comment: No Top file or master_tops data matches found.
     Changes:   

Summary for salt-master-1
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.000 ms
dev-docker-1:
----------
          ID: states
    Function: no.None
      Result: False
     Comment: No Top file or master_tops data matches found.
     Changes:   

Summary for dev-docker-1
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.000 ms
ERROR: Minions returned with non-zero exit code

If I look at the logs for the minion, dev-docker-1 nothing is logged as an error, all that I see is this.

2018-11-08 18:33:12,993 [salt.minion      :1429][INFO    ][4883] User sudo_salt Executing command state.apply with jid 20181108183312990343
2018-11-08 18:33:13,015 [salt.minion      :1564][INFO    ][5438] Starting a new job with PID 5438
2018-11-08 18:33:13,331 [salt.state       :933 ][INFO    ][5438] Loading fresh modules for state activity
2018-11-08 18:33:13,448 [salt.minion      :1863][INFO    ][5438] Returning information for job: 20181108183312990343

Any help greatly appreciated as I'm a bit lost as to why this isn't working . . .

Edit 1

I have enabled verbose logging on the minion, and I see the following, seems it can't see the top.sls file

[DEBUG   ] Could not find file 'salt://top.sls' in saltenv 'base'
[DEBUG   ] No contents loaded for saltenv 'base'
[DEBUG   ] No contents found in top file. If this is not expected, verify that the 'file_roots' specified in 'etc/master' are accessible. The 'file_roots' configuration is: {u'base': []}

Upvotes: 2

Views: 2776

Answers (1)

Gareth Jeanne
Gareth Jeanne

Reputation: 1420

Ok so I worked this out, operator error.

I had enabled gitfs backend in the config file, which has overridden the default base file system, so I just needed to do.

fileserver_backend:
  - gitfs
  - base

Doh!

Upvotes: 1

Related Questions