I built a state file in salt to copy a list of check_mk Nagios scripts down to the remote server. Below is a snip of the state file.

    - name: /usr/lib/check_mk_agent/local
    - source: salt://{{ slspath }}/files/cmk_checks
    - user: nagios
    - group: users
    - file_mode: 754
    - dir_mode: 755
    - require:
      - check_mk_agent_installed

The funny thing is, when I run the sls state directly everything works. See below.

    salt-call state.sls dev.roles.srvr.system_conf.check_mk    
                  ID: check_mk_defined_checks
            Function: file.recurse
                Name: /usr/lib/check_mk_agent/local
              Result: True
             Comment: The directory /usr/lib/check_mk_agent/local is in the correct state
             Started: 20:54:29.105625
            Duration: 1475.026 ms

However, when I run it as apart of a highstate I get the following error.

          ID: check_mk_defined_checks
    Function: file.recurse
        Name: /usr/lib/check_mk_agent/local
      Result: False
     Comment: Recurse failed: none of the specified sources were found
     Started: 20:45:19.369238
    Duration: 917.113 ms

I have spent way to much time working on this. I can not use the recurse function in any state or I get the same results. It works when you call the state directly but not as apart of a highstate.

Any help anyone can provide would be great.


  • Have you tried hardcoding the {{ slspath }} part? – Marcus Nov 16 '18 at 19:18
  • Yes. If I hardcode the path it will work. However, that solution will not work for me because I have 3 environments, dev, test, and prod. Each environment has their own path. Thus the reason I have the {{ slspath }} jinja variable specified. – Edwardcode Nov 26 '18 at 16:46

The source files/cmk_checks needs to be present in all environments and the paths on the master will be environment specific.

It's likely your salt-call run is executing the state in different environment than your highstate. You should run salt-call state.sls with saltenv=… argument.

| improve this answer | |
  • holee crepe thank you so much. I so often have doubts about using saltstack... this solution even worked on 2015.5.10 (Lithium), – Rich K. Apr 2 '19 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.