Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Last active March 21, 2021 20:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwilczynski/3bafd8b67b4c7cd0cb37 to your computer and use it in GitHub Desktop.
Save kwilczynski/3bafd8b67b4c7cd0cb37 to your computer and use it in GitHub Desktop.
Quickly test Salt state from current directory
vagrant@ubuntu1404:~$ sudo salt-call --local --file-root=. --pillar-root=. state.sls test
[INFO ] Loading fresh modules for state activity
[INFO ] Fetching file from saltenv 'base', ** skipped ** latest already in cache 'salt://test.sls'
[INFO ] Running state [echo 'Hello Dave, would you like to play chess?'] at time 15:05:30.278219
[INFO ] Executing state cmd.run for echo 'Hello Dave, would you like to play chess?'
[INFO ] Executing command "echo 'Hello Dave, would you like to play chess?'" in directory '/home/vagrant'
[INFO ] {'pid': 2901, 'retcode': 0, 'stderr': '', 'stdout': 'Hello Dave, would you like to play chess?'}
[INFO ] Completed state [echo 'Hello Dave, would you like to play chess?'] at time 15:05:30.282402
local:
----------
ID: test
Function: cmd.run
Name: echo 'Hello Dave, would you like to play chess?'
Result: True
Comment: Command "echo 'Hello Dave, would you like to play chess?'" run
Started: 15:05:30.278219
Duration: 4.183 ms
Changes:
----------
pid:
2901
retcode:
0
stderr:
stdout:
Hello Dave, would you like to play chess?
Summary
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
vagrant@ubuntu1404:~$ cat test.sls
test:
cmd.run:
- name: echo 'Hello Dave, would you like to play chess?'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment