VMware Aria Automation Config: Write Your First Salt State
- Taylor Norris
- Apr 11, 2023
- 3 min read
You just deployed VMware Aria Automation Config (Note: SaltStack Config is now called Aria Automation Config) and are excited to get started on your multi-cloud configuration management journey. The only problem is that you don’t know how to write your first salt state. Don’t worry, in this blog post I will show you how to write your first Salt State file and save it to the file server in Aria Automation config. By the end of this post, you will learn how to create a salt state using YAML, add comments to that salt state, search for the correct salt module to use, and then save the salt state to the file server.
To start out, log into Aria Automation Config, click the "Config" dropdown, and select "File Server".

Next, select your salt environment and enter your path name. For "salt environment" I will select "base". For Path name, I will create a folder called "/myfirstsaltstate" and in that folder create a salt state file called "install_nginx.sls". Notice the .sls file extension. All salt states will use the .sls file extension.

Now that I have my salt environment and path name, I can start to write my first state file. We will write this salt state using YAML, which is the default language for creating salt states, but you can also write states in python or json. You can also template your state files using jinja, but I will save that for another blog post. We will start by creating a comment to describe what our state file is doing. To create a comment, you can enter the pound or hash symbol “#”, followed by your description. For my description, I will enter "This salt state installs Nginx and makes sure the Nginx service is running". Notice the text changes to green when we enter a comment.

Now that we have a comment describing what our state does, we can start to build out the rest of the state file. We start by creating a unique name or id, so I will enter "install_nginx_package:" (make sure to add the colon). Next, I need to enter my module.function name. To install the nginx package we will use the "pkg" module and the "installed" function.

When you are unsure which module/functions to use, it is best to perform a quick google search. I will search for “SaltStack install package” and click on the salt.state.pkg link. This will take us to the salt open documentation. We can see that the salt.state.pkg module will allow us to install packages. Specifically, we will want to use the “pkg.installed” module/function.


Jumping back into the console, I will hit enter, enter two spaces, then “pkg.installed:”, press enter and then space bar twice, enter a -, enter a space, then I will need an argument and value. I will enter "name:", enter a space, and then the name of my package which is "nginx". We now have the YAML required to install the nginx package.

Once the package is installed though, we want to make sure that the service is running. For this we will use the service module and running function. I need to enter another unique name or identifier, so I will call this "nginx_running:" making sure to add a colon at the end. Press enter then space bar two times. I will search google for SaltStack start service and see there is a salt.states.service state module.

To make sure the service is running we will want to use the "running" function.

Jumping back into the console I will enter "service" for the module name and ".running:" for the function name. Then I will enter a dash (-), enter a space, type "name:", enter a space, then type "nginx".

If I click save this will save the state file to the file server. To validate that this salt state was created, I can click the drop down beside base, then myfirstsaltstate, and we can see that the install_nginx_.sls state file was saved to the file server.

I now have a saved salt state that will install the nginx package using the pkg.installed module/function, and make sure the service is running after the installation using the service.running module/function.
Stay Salty!
Additional Resources
Comments