ManageLearn to apply best practices and optimize your operations.
Learn how to manage vSphere environments with SaltStack
The SaltStack management tool allows admins to create a consistent management system for multiple operating systems, including VMware vSphere environments.
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
Step 2 of 2:
requires a consistent management system. SaltStack is emerging as a tool that offers an alternative to offerings such as Puppet, Ansible and Chef. In this article, we'll discuss how it can be used to manage vSphere environments.
SaltStack provides the means to manage state on target systems, the so-called minions. Any configuration can be managed and applied to remote systems SaltStack through the use of efficient remote execution engines. Although it was designed primarily for the Linux platform, SaltStack can manage other operating systems as well, including VMware vSphere environments.
How SaltStack works
Using SaltStack to manage vSphere environments allows administrators to develop a generic deployment and management strategy that can be applied to physical as well as virtual assets.
SaltStack functions on a minion and master topology. SaltStack works with specific commands that can be executed on one or more minions. To make this happen, the minion key is imported on the Salt Master, at which point the Salt Master administrator can issue commands like salt'*' cmd.run 'ls -l /'. This command runs the ls -l / command on all minions currently known to the Salt Master.
Apart from running remote commands, SaltStack allows administrators to use grains. A grain makes it possible to run remote queries on SaltStack minions, thus collecting status information about the minions and allowing administrators to store that information in a central location. Among the many features that are offered, SaltStack can also work with states, which help administrators define a desired state on a target system. These states are applied by using .sls files, which contain very specific instructions about what should happen on a system to obtain a desired state.
Because of the flexibility it offers in managing remote systems, SaltStack-based products are rapidly gaining interest. The functionality can be compared to features that are offered by state management systems such as Puppet and Ansible. SaltStack takes thing a step further and owes its rapid adoption rates to the fact that it includes an efficient way to run remote commands on management systems.
Using SaltStack to manage vSphere
SaltStack can also manage vSphere environments, but the VMware cloud module needs to be configured . This module contains the URL to the vSphere server, as well as a username and password needed to connect to VMware. The /etc/salt/cloud.providers file on the Salt Master is the typical location where this information is stored. Listing 1, shown below, shows sample contents of this file, which allows the Salt Master to interact with target VMware systems.
Once the connection to the vSphere environment has been defined, SaltStack can talk directly to the vSphere server and perform automated operations, such as starting VMs. In order to do so, a profile needs to be defined. Listing 2, shown below, offers an example of such a profile.
Once the profile has been defined, it needs to be applied. As a salt cloud module is used to interface with the vSphere infrastructure, you should use the salt-cloud command to do so. The generic structure of this command is salt-cloud -p myprofile myinstance. This command applies a profile as shown in Listing 2 to deploy an instance with the name myinstance.
Using SaltStack to manage vSphere environments allows administrators to develop a generic deployment and management strategy that can be applied to physical as well as virtual assets.