Salt state functions

Salt state functions are used to install and configure applications on our remote system. Let us install a “Vim” package using the Salt state function.

Create and Apply State Function

Create a file named “sample.sls”

#cat sample.sls

install vim:

   pkg.installed:

      - name: vim

Run the salt-master and apply the sample.sls by running the following command.

#salt ubuntu-01 state.apply sample

we have added a package “Vim”. Let us now test the package using the Salt testing method.

Salt State Testing

The test run by adding the “test = True” option to the states. The return information will show states that will be applied in yellow and the result is reported as ‘None’.

The following command is used to test the state

Recent Comments

No comments

Leave a Comment