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
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/
I changes the
file_root:
base:
- /etc/salt/srv/salt/state
and it works for me. looks it wasn't picking path correctly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With