Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Salt-stack list all available states

Tags:

salt-stack

I already searched the doc and was not able to find an satisfying answer. Is it possible to get something like salt 'machine' state.list. To get all states that could be potentially applied?

I know there is the high state / top / lowstate, but if i want to search for a particular state i always need to go through the folder structure manually.

like image 239
PlagTag Avatar asked Jul 25 '16 09:07

PlagTag


People also ask

What are Salt states?

States in the salt belt include Alaska, Connecticut, Delaware, Illinois, Indiana, Iowa, Kansas, Kentucky, Maine, Maryland, Massachusetts, Michigan, Minnesota, Missouri, Nebraska, New Hampshire, New Jersey, New York, North Dakota, Ohio, Pennsylvania, Rhode Island, South Dakota, Vermont, Virginia, West Virginia, ...

What is Salt high state?

A “highstate” is a way for Salt to dynamically determine which Salt Formulas should be applied to a certain minion. To start with you execute a “highstate” like this: salt 'minion01' state.highstate. This command causes the Minion to download and examine a file from the Salt Master called the “top file”.

Where are Salt states stored?

All user-created Salt state (SLS) files are saved on the SUSE Manager Server, in the /srv/susemanager/salt/ directory. Within that directory, each organization has a sub-directory.

How do I apply for Salt state?

On your Salt master, run the following command to apply the Top file: salt '*' state. apply #calling state. apply with no arguments starts a highstate.


2 Answers

Use salt '*' state.show_sls '*' on master and salt-call state.show_sls '*' on minions

like image 155
Saurav Shanu Avatar answered Oct 01 '22 13:10

Saurav Shanu


I use this...

Is a little one liner command you can set as an alias

cd /srv/salt; tree -fC -P '*.sls' --noreport * | sed 's/.sls//g' | sed 's|\/|.|g' 
like image 22
Juan Medina Avatar answered Oct 01 '22 14:10

Juan Medina