Search code examples
salt-project

No matching sls found for 'dnsinstall.sls' in env 'base'


I'm setting up a DNS server using salt-stack. But the env=base is going wrong somewhere

First, run with salt 'ubuntu' state.apply dnsinstall:

ubuntu:

      ID: install bind9
Function: pkg.installed
    Name: bind9
  Result: True
 Comment: The following packages were installed/updated: bind9
 Started: 02:40:06.590171
Duration: 14219.3 ms
 Changes:   
          ----------
          bind9:
              ----------
              new:
                  1:9.10.3.dfsg.P4-8ubuntu1.15
              old:
          bind9utils:
              ----------
              new:
                  1:9.10.3.dfsg.P4-8ubuntu1.15

old:

      ID: install bind9utils
Function: pkg.installed
    Name: bind9utils
  Result: True
 Comment: Package bind9utils is already installed
 Started: 02:40:20.816659
Duration: 277.111 ms

Changes:

      ID: install bind9_doc
Function: pkg.installed
    Name: bind9-doc
  Result: True
 Comment: The following packages were installed/updated: bind9-doc
 Started: 02:40:21.094023
Duration: 4857.395 ms
 Changes:   
          ----------
          bind9-doc:
              ----------
              new:
                  1:9.10.3.dfsg.P4-8ubuntu1.15
              old:

Summary for ubuntu

Succeeded: 3 (changed=2)

Failed: 0

Total states run: 3 Total run time: 19.354 s

But when I 2nd run the same code:

ubuntu:

Data failed to compile:

No matching SLS found for 'dnsinstall.sls' in env 'base'

I also make a file.managed to push to the config file and also have the same problems:

quan@quanlm:/srv/salt$ sudo salt '*' state.apply dnsconfig.sls

ubuntu:

Data failed to compile:

No matching sls found for 'dnsconfig.sls' in env 'base'

But when I try to run this line:

sudo salt-run fileserver.file_list saltenv=base

  • dnsconfig.sls

  • dnsinstall.sls

  • named.conf.options

The saltenv=base contains those file

My dnsconfig.sls

deploy the config file:

file.managed:

- name: /etc/bindnamed.conf.options

- source: salt://named.conf.options

- mode: 644

My dnsinstall.sls

install bind9:

pkg.installed:

- pkgs:

  - bind9

  - bind9utils

  - bind9-doc

Where I'm wrong at, I don't understand why it won't work normally


Solution

  • 😁 well, that's my classic "back from holidays" mistake... You may not include the file extension when running the command:

    No matching SLS found for 'dnsinstall.sls'
    

    I guess you used this command line:

    Salt ubuntu state.apply dnsinstall.sls
    

    When you should use:

    Salt ubuntu state.apply dnsinstall
    

    Note the missing .sls in the second and correct call.