Search code examples
salt-project

No matching sls found for 'httpd' in env 'base'


I am trying to install and set-up some basic saltstack states.

I am getting the following error when trying to apply a state: No matching sls found for 'httpd' in env 'base'

My setup is as follows:

Centos 7.7.1908

Salt 3000

My directory structure is: /etc/salt/srv/salt/httpd.sls

And my file contains:

install_httpd:
  pkg.installed:
    - httpd

The command I am running is:

salt minion state.sls httpd

I have also tried created a top.sls file under:

/etc/salt/srv/pillar/top.sls

And this file contains:

base:
  '*':
    - httpd

But I get the same error. However, as far as I am aware, a top.sls file should not be necessary.

Does anyone have any suggestions on this?

Cheers


Solution

  • So, I found the answer to my own question.

    I was assuming that /srv/salt/ should exist within /etc/salt/, which was incorrect. /srv/salt/ should be its own directory. So if I run pwd while inside /srv/salt/ it looks like this: /srv/salt

    If you want to change this so that /srv/salt can sit within /etc/salt/ you will need to adjust your file_roots on line 667 of /etc/salt/master to be:

    file_roots:
      base:
        - /etc/salt/srv/salt