Unlock the power of SaltStack Grains to efficiently manage system metadata in your DevOps workflows! Learn how grains provide critical, static info about your systems that streamline automation and improve configuration accuracy. Don’t get left behind—master SaltStack grains today for smarter, faster infrastructure management! #CentLinux #Linux #SaltStack
Table of Contents
Introduction to SaltStack Grains
If you’ve been working with SaltStack for a while, you’ve probably come across the term “grains.” At first glance, they might seem like just another technical feature, but in reality, SaltStack grains are one of the most powerful aspects of Salt’s infrastructure automation system. They serve as the backbone of intelligent configuration management, helping Salt understand every tiny detail about your systems—from their operating system and hardware to their roles and environments. (SaltStack Official website)
Grains are small pieces of information that Salt automatically collects from a minion. Think of them as static metadata about a system. This metadata is essential for decision-making in automation—like applying different configurations to Ubuntu servers versus Red Hat servers, or defining custom behavior based on CPU architecture. Without grains, Salt wouldn’t know how to adapt configurations intelligently.
In modern DevOps environments, where servers, containers, and cloud instances evolve rapidly, having reliable and easily accessible metadata becomes critical. That’s where SaltStack grains shine. They give administrators a simple yet powerful way to query and manage system information dynamically. Whether you’re managing ten servers or ten thousand, grains help you maintain order and precision.
In this guide, we’ll explore everything you need to know about SaltStack grains—from what they are and how they work to creating custom grains, using them in states, and troubleshooting common issues. By the end, you’ll be able to use grains to make your SaltStack configurations smarter, faster, and more flexible.

What Are SaltStack Grains?
SaltStack grains are essentially key-value pairs that store system-level information about a minion. Each Salt minion (an agent running on a managed machine) gathers data about itself—like its OS type, IP address, hostname, CPU count, and more—and stores it in what Salt calls “grains.” This data is readily available to both the Salt master and the minion itself, making it easy to target, configure, and manage systems based on their unique characteristics.
For instance, you can use grains to ask questions like:
- “Which of my servers are running Ubuntu 22.04?”
- “How many CPUs does each minion have?”
- “What environment does this server belong to—production or development?”
The beauty of grains is that they are instantly accessible without needing to run any external commands. Since grains are stored locally on each minion, Salt can quickly read the data without needing to communicate with the master every time. This makes them extremely efficient, especially when dealing with large infrastructures.
Here’s a simple example. If you run the following command:
salt '*' grains.item osYou’ll get an output like:
minion1:
os: Ubuntu
minion2:
os: CentOSGrains can include anything from OS details to custom attributes you define yourself. You can even create your own grains for organizational metadata—like assigning departments, datacenters, or roles to systems.
In essence, SaltStack grains act as the “identity card” for each minion. They’re small, lightweight, and powerful—just like real grains that build the foundation of something much bigger.
The Role of Grains in Configuration Management
Grains play a central role in Salt configuration management model. They’re the foundation that allows Salt to make smart, context-aware decisions when applying configurations. Without grains, Salt wouldn’t be able to differentiate between servers running different operating systems or belonging to different environments.
Imagine you’re deploying a web server stack across multiple machines. Some are running Ubuntu, others on CentOS. The package manager commands and dependencies differ between these systems. With SaltStack grains, you can automatically detect which OS each Salt minion uses and apply the correct configuration accordingly. This eliminates the need for manual intervention or maintaining multiple separate state files for each platform.
Moreover, grains help maintain consistency across deployments. You can use them to define global policies—for example, ensuring all production servers use a specific NTP configuration or all database servers have the correct performance tuning parameters.
Grains can also influence high-level orchestration. For example:
- You can target systems by grain values (e.g., “all minions with role: webserver”).
- You can apply conditions in state files using Jinja templating.
- You can integrate grains into external systems for reporting or monitoring.
Essentially, grains make your infrastructure intelligent. Instead of pushing generic configurations everywhere, Salt uses grains to tailor its behavior to each minion’s specific attributes. This makes deployments not only more efficient but also more reliable and scalable.
How Grains Work in SaltStack
To understand the true potential of SaltStack grains, you first need to know how they operate under the hood. Grains are generated and stored locally on each minion, meaning every minion has its own set of grain data that describes its system. These grains are collected when the Salt minion starts up. Once gathered, they’re cached so Salt can access them instantly—without needing to re-run detection commands each time.
There are two main types of grains: static grains and dynamic grains.
- Static grains are those that rarely change. For instance, the operating system, kernel version, and CPU architecture of a machine typically remain constant during its lifetime. Salt collects this information once when the minion starts and then stores it for fast access.
- Dynamic grains, on the other hand, can change over time. These might include values like IP addresses, network interfaces, or certain custom grains you define. Salt can refresh these grains on demand when you run specific commands.
Under the hood, SaltStack grains are collected using Python modules located in the Salt minion’s grains directory. When the minion starts, it runs these modules, gathers data, and stores the results in memory. This approach makes grains extremely fast to retrieve because the data doesn’t require live system queries or communication with external services every time you use it.
Here’s a simplified flow:
- The minion starts.
- Grains modules execute and collect data.
- The collected data is stored in a local cache.
- When you query grains (via CLI or states), Salt reads from the cache.
This architecture has several advantages. It improves performance, since grains are always available locally; enhances scalability, as each minion handles its own data; and increases reliability, because even if the Salt master is temporarily unavailable, the minion still knows everything about itself.
In short, grains are the static foundation of a dynamic SaltStack ecosystem. They provide the metadata that informs every higher-level automation process.
Default Grains Available in SaltStack
When you install SaltStack, you automatically get a rich collection of built-in grains. These default grains give you detailed information about your systems right out of the box—no extra configuration required. They cover a wide range of categories, such as system, hardware, network, and OS details.
Here are some of the most common default grains you’ll find:
| Category | Example Grains | Description |
|---|---|---|
| System Info | id, localhost, fqdn | Basic system identifiers like hostname and FQDN |
| OS & Kernel | os, os_family, osrelease, kernel, kernelrelease | Provides OS details and kernel version |
| Hardware | num_cpus, cpu_model, mem_total, virtual | Information about CPU, RAM, and virtualization |
| Network | ip_interfaces, ipv4, ipv6, fqdn_ip4 | Lists all IP addresses and network interfaces |
| Location | domain, dns, timezone | Gives DNS domain and time zone data |
| Salt-Specific | saltversion, pythonversion, uuid | Provides Salt and Python version info |
For example, if you want to see all grains for a specific minion, simply run:
salt 'webserver1' grains.itemsYou’ll receive a detailed list of everything Salt knows about that system—hundreds of key-value pairs that you can leverage for targeting and automation.
Among these, some grains are particularly useful for everyday tasks:
os_family: Used to group operating systems into logical families (e.g., Debian, RedHat).roles: Often customized to define server purposes (e.g., webserver, database, proxy).env: Commonly used to distinguish between environments like “dev,” “test,” and “prod.”
By understanding the built-in grains, you’ll save time when building states and targeting minions. Salt gives you this foundational dataset so you can start automating intelligently from day one.
Viewing and Managing Grains
Now that you know what grains are and how they work, let’s explore how to view, query, and manage them effectively. SaltStack provides powerful commands that make it easy to inspect and manipulate grain data.
The most common command to list all grains is:
salt '*' grains.itemsThis displays all grain data for all minions. You can also retrieve a single grain’s value:
salt '*' grains.item osOr list specific grains for all minions:
salt '*' grains.lsIf you’re managing a large environment, you’ll want to filter grain output to focus on what matters. You can use Jinja or command-line targeting to filter by grain values. For example:
salt -G 'os:Ubuntu' test.pingThis command targets all minions running Ubuntu.
Salt also supports nested grains. Some grains are structured in dictionaries (like ip_interfaces), so you can access specific elements:
salt '*' grains.get ip_interfaces.eth0Managing grains can also include setting custom grains. These can be added manually in the minion configuration file (/etc/salt/minion) under the grains section. For instance:
grains:
role: webserver
env: productionAfter saving changes, you’ll need to refresh the grains cache:
salt-call saltutil.sync_grainsThis simple setup allows you to classify minions based on business logic, such as environments, application roles, or datacenter locations. The best part? These grains become instantly available for targeting, conditional logic, and reporting.
With proper management, grains give you a structured and consistent way to describe your infrastructure—no matter how large or complex it grows.
Creating Custom Grains
While SaltStack ships with a wealth of built-in grains, there are plenty of scenarios where you’ll need custom grains to tailor Salt to your organization’s unique needs. Custom grains allow you to define metadata that isn’t automatically detected by Salt—like your own system roles, environment labels, or even custom hardware identifiers. Think of them as “tags” you create to make Salt more aware of your infrastructure.
There are two main ways to create custom grains:
- Static custom grains (declared in configuration files)
- Dynamic custom grains (written as Python scripts)
Let’s break both down.
Static Custom Grains
Static grains are the simplest and most common form of custom grains. You define them manually in a YAML configuration file on the minion, usually located at /etc/salt/minion. You’ll add a section called grains, like this:
grains:
role: webserver
env: production
owner: devops_teamOnce this is saved, refresh the grains cache with:
salt-call saltutil.sync_grainsNow, if you run:
salt-call grains.item roleYou’ll see:
local:
webserverThese grains are easy to create and maintain, and they’re ideal for static information that doesn’t change frequently—like environment names, department ownership, or machine purpose.
You can also define them centrally using Salt’s configuration management by pushing updates through state files. For example, you might manage your /etc/salt/minion file with a Salt state, ensuring all servers in the “prod” environment automatically get the same env: production grain.
Dynamic Custom Grains
If you need grains that change based on system conditions or need to be computed dynamically, you’ll want dynamic grains. These are written in Python and stored in the /_grains/ directory on the minion (or in a shared directory synced from the master).
A simple example of a dynamic grain might be one that detects whether a specific service is running:
# /srv/salt/_grains/service_status.py
import subprocess
def service_status():
try:
output = subprocess.check_output(['systemctl', 'is-active', 'nginx']).decode().strip()
return {'nginx_status': output}
except subprocess.CalledProcessError:
return {'nginx_status': 'inactive'}After placing this file, sync the grains:
salt '*' saltutil.sync_grainsThen check the new grain:
salt '*' grains.item nginx_statusDynamic grains can also gather information from external APIs, databases, or cloud metadata services. This makes them incredibly flexible—perfect for complex, large-scale deployments.
Whether static or dynamic, custom grains give SaltStack the contextual intelligence to automate decisions just like a human engineer would—but at lightning speed and scale.
Using Grains in Salt States
Grains become truly powerful when used within Salt states. States are the building blocks of configuration management in Salt, defining what a system should look like. By using grains, you can make your states dynamic—tailoring configurations based on real-time system data.
Let’s start with a simple example. Suppose you want to install different web servers depending on the operating system:
install_webserver:
pkg.installed:
- name: {{ 'httpd' if grains['os_family'] == 'RedHat' else 'apache2' }}In this example, the Jinja templating engine uses the grains variable to decide which package to install. This prevents you from writing two separate state files for Red Hat and Debian-based systems.
Another practical example—setting the correct time zone depending on the environment:
set_timezone:
timezone.system:
- name: {{ 'UTC' if grains['env'] == 'production' else 'America/New_York' }}You can also use grains to conditionally include other state files:
{% if grains['role'] == 'database' %}
include:
- mysql.server
{% elif grains['role'] == 'webserver' %}
include:
- nginx.server
{% endif %}Grains in Salt states allow you to manage heterogeneous environments elegantly. You can define a single, flexible state file that applies to any system, automatically adjusting based on its properties.
This approach is especially useful in cloud or hybrid environments where systems come and go frequently, and manual classification isn’t feasible. With grains, Salt can “understand” each minion’s purpose and act accordingly.
Targeting Minions Using Grains
One of the most common and powerful uses of grains is targeting. Targeting allows you to apply commands or states only to certain minions that match specific criteria—based on their grain values.
The syntax for targeting by grain is straightforward. You can use the -G flag in the Salt command line:
salt -G 'os:Ubuntu' test.pingThis command will only ping minions whose os grain equals “Ubuntu.”
You can also target by custom grains:
salt -G 'role:webserver' state.apply nginxFor more complex conditions, Salt supports compound targeting, where you can combine multiple grains:
salt -C 'G@role:webserver and G@env:production' test.pingThis targets only production web servers. You can even mix grains with other targeting methods, such as by minion ID or list.
Targeting with grains makes automation more surgical and efficient. Instead of deploying configurations blindly, you can ensure every command reaches exactly the right systems. It’s like having a smart filter that understands your infrastructure’s structure and purpose.
Read Also: Mastering Ansible Variables for Automation Success
Updating and Refreshing Grains
As dynamic as SaltStack is, sometimes the information in your grains might become outdated—especially if you make system changes like adding a new network interface, modifying environment tags, or updating OS details. This is where refreshing grains becomes important. Refreshing ensures that your Salt minion’s metadata stays current and accurate, so your configurations and targeting remain reliable.
When a minion starts, Salt automatically gathers and caches grain data. However, that data doesn’t automatically refresh unless the minion restarts or you explicitly tell Salt to update it. For example, if a system’s IP address changes, the ip_interfaces grain won’t update until you refresh grains.
To manually refresh grains on a minion, you can use one of these commands:
salt '*' saltutil.sync_grainsor
salt '*' saltutil.refresh_grainsThe sync_grains command reloads custom grain modules from the master, ensuring new or modified Python grain files take effect. The refresh_grains command, on the other hand, re-runs all grain modules and updates cached values—without needing a full minion restart.
You can also refresh grains locally on a single minion using:
salt-call saltutil.refresh_grainsIn environments where changes happen often—like cloud or containerized systems—it’s best practice to include periodic grain refreshes in your automation workflows. For example, you can schedule a cron job or include a grain refresh as part of your deployment pipelines.
When to Refresh Grains
- After changing or adding custom grain definitions.
- When system properties like IPs, hostnames, or hardware configurations change.
- When grains show incorrect or outdated data.
- Before running large-scale targeting operations based on grain values.
Performance Tip
Refreshing grains is generally lightweight, but in massive infrastructures with thousands of minions, avoid doing it too frequently, as it can generate unnecessary load on the master. Schedule refreshes strategically—perhaps daily or after system modifications.
Keeping your grains updated is crucial for consistent automation. Think of it as keeping your “source of truth” polished and ready, ensuring Salt always makes decisions based on the most recent and accurate system data.
Troubleshooting Common Grain Issues
Even though SaltStack grains are designed to be reliable and efficient, sometimes issues arise—especially in large or complex setups. Knowing how to troubleshoot them can save you hours of frustration and ensure your automation remains dependable.
Let’s go over some common problems and how to fix them.
1. Missing or Inaccurate Grain Values
Sometimes, a minion might not show expected grain data. This usually happens when:
- The minion hasn’t been restarted after adding or modifying grains.The grain module failed to load properly.Cached grain data is stale.
Fix:
Refresh grains with:
salt '*' saltutil.refresh_grainsIf custom Python grains were added, also run:
salt '*' saltutil.sync_grainsRestart the Salt minion service if needed:
systemctl restart salt-minion2. Grain Cache Corruption
Salt stores grains in a local cache to speed up lookups. Occasionally, this cache can become corrupted. If you see inconsistent or partial grain data, clearing the cache can help.
Fix:
Delete the grain cache file (usually at /var/cache/salt/minion/grains.cache.p) and restart the minion:
rm -f /var/cache/salt/minion/grains.cache.p
systemctl restart salt-minion3. Custom Grain Scripts Not Loading
If you’ve created custom grains in _grains/ but they’re not showing up:
Ensure your Python file name doesn’t conflict with existing built-in grain modules.
Check for syntax errors in your Python script.
Verify that the _grains/ directory is accessible to the minion.
Resync grains using
saltutil.sync_grains4. Slow Grain Queries
Grain queries are usually instantaneous because they’re cached locally. However, if querying grains takes too long, it might be due to:
Overloaded minions or I/O bottlenecks.
Custom grains running heavy or slow system commands.
Fix:
Simplify your custom grain logic to avoid complex shell commands.
Consider caching dynamic values manually within your script.
5. Grains Not Matching During Targeting
If targeting with grains isn’t returning expected minions, confirm that the grain values you’re using match exactly. Grain matching is case-sensitive. You can test by running:
salt '*' grains.get role This helps verify whether the role grain is set correctly.
When troubleshooting grains, remember: the issue is almost always local to the minion. Grains are stored and processed locally, so solving the problem typically involves the affected system, not the master.
With these simple checks, you can quickly restore accurate and reliable grain functionality.
Practical Use Cases of SaltStack Grains
Grains aren’t just technical metadata—they’re the key to building smart, adaptive infrastructure automation. Once you understand how to leverage them effectively, you can solve a wide range of real-world challenges.
Here are some practical and creative ways to use SaltStack grains in daily operations:
1. Environment-Specific Configuration
Let’s say your infrastructure spans multiple environments—development, staging, and production. You can define a custom grain env for each minion:
grains: env: production Then, in your state files, conditionally apply settings:
{% if grains['env'] == 'production' %}
include:
- monitoring.prod
{% else %}
include:
- monitoring.dev
{% endif %}This ensures each environment gets configurations suited to its purpose.
2. Hardware-Based Deployments
Suppose you have both physical and virtual machines. Using the built-in virtual grain, you can assign tasks accordingly:
salt -G 'virtual:kvm' state.apply virtual_hosts
salt -G 'virtual:physical' state.apply bare_metal3. Security and Compliance
Use grains to tag and monitor systems with specific compliance requirements (e.g., compliance: PCI). Then easily target and audit them using Salt commands.
4. Data Center or Region-Based Targeting
If your servers span multiple locations, you can add a location grain and deploy updates region-wise:
salt -G 'location:us-east' state.apply updates5. Service Role Identification
Assign role grains to define system types—like webserver, database, or loadbalancer. Then use this for targeted rollouts:
salt -G 'role:webserver' state.apply nginx.updateThese use cases show how grains transform SaltStack from a basic automation tool into a context-aware orchestration engine. With just a few lines of configuration, you can make Salt “understand” your infrastructure at a granular level.
Best Practices for Managing Grains
Managing SaltStack grains effectively is as much about discipline as it is about automation. Since grains form the foundation for targeting, configuration, and decision-making, poor management can quickly lead to chaos—especially in large-scale deployments. To keep your grains organized, reliable, and efficient, following a set of best practices is essential.
Here are the most important best practices for managing SaltStack grains:
1. Keep Grain Names Consistent and Meaningful
Use clear, descriptive names for your custom grains. For instance, use env, role, location, and owner instead of vague terms like type1 or sitea. Consistent naming makes it easier for your entire team to target minions and understand the infrastructure layout without confusion. Example:
grains:
env: production
role: webserver
location: us-east2. Avoid Redundant or Overlapping Grains
Don’t duplicate data that’s already available through built-in grains. For instance, Salt already provides grains like os, os_family, and kernelrelease, so there’s no need to create a custom platform grain. Redundancy increases complexity and the chance of conflicts.
3. Use Standardized Values
When defining grain values (especially for environments or roles), stick to standardized formats. For example, always use lowercase (production, not Production) and be consistent across all minions. Since grain matching is case-sensitive, standardization prevents subtle targeting errors.
4. Document Custom Grains
Maintain a central documentation file—like a grains_reference.md—that lists all custom grains, their purposes, and allowed values. This ensures that as your team grows, everyone understands how grains are used and avoids redefining or misusing them.
5. Use Custom Grains for Business Logic, Not Temporary Data
Grains should store metadata that represents a system’s long-term identity or classification, not transient or runtime data. If you need to store frequently changing information (like dynamic configuration variables), consider using Pillars instead. Grains are cached and designed for relatively static data.
6. Leverage Grains for Conditional Logic and Targeting
Build your Salt states to be dynamic using grains. For example, instead of maintaining separate state files for different environments, use Jinja templates that adapt based on grains. This keeps your Salt codebase clean and maintainable.
7. Refresh Grains Periodically
As mentioned earlier, grains can become outdated. Schedule a regular refresh, especially after system updates or hardware changes. In dynamic environments, a daily or weekly refresh is a good balance between accuracy and performance.
8. Version Control Your Custom Grains
Store your custom grain scripts (from the _grains/ directory) in your Git repository alongside other Salt files. This ensures that any changes are tracked, reviewed, and synchronized across environments.
9. Test Custom Grains Thoroughly
Always test custom Python grains locally using:
salt-call --local grains.itemsThis helps catch syntax errors or performance issues before deploying them across hundreds of minions.
10. Avoid Excessive Grain Data
Although it’s tempting to store lots of metadata in grains, too much data can bloat the cache and slow down Salt operations. Keep grains focused on essential information that supports configuration logic or targeting.
By adhering to these best practices, you’ll create a clean, predictable, and highly scalable SaltStack environment. Well-managed grains reduce errors, improve collaboration, and make your infrastructure automation smoother and more intelligent.
Comparing Grains with Pillars and Facts (Ansible)
It’s easy to confuse grains, pillars, and facts, especially if you’ve worked with other configuration management tools like Ansible. While they all store metadata, each serves a distinct purpose. Understanding their differences helps you decide when to use one over the other.
| Feature | Salt Grains | Salt Pillars | Ansible Facts |
|---|---|---|---|
| Data Source | Local on minion | Defined on master | Collected dynamically on target |
| Data Type | Static system metadata | Sensitive or configurable data | Dynamic system information |
| Update Frequency | Cached; changes on refresh | Controlled by master | Collected per playbook run |
| Security | Visible to both minion & master | Private (master-controlled) | Private to controller |
| Use Case | Targeting, classification, conditional states | Secrets, environment data, configuration variables | Targeting, templating, dynamic decisions |
Grains vs Pillars:
- Grains are generated by the minion itself, describing its hardware, OS, and identity.
- Pillars, on the other hand, are defined by the master and can contain sensitive information (like passwords, API keys, or configuration values).
For example, use grains to determine which environment a server is in and use pillars to store that environment’s credentials or configs.
Grains vs Ansible Facts:
Ansible facts are dynamically gathered each time you run a playbook, whereas Salt grains are persistent and cached locally. This means grains are faster to access but may need refreshing, while Ansible facts are always up-to-date but collected slower.
In short:
- Use grains for static or identity-based metadata.
- Use pillars for secrets and configuration data.
- Use Ansible facts if you’re operating in the Ansible ecosystem.
Advanced Grain Techniques
Once you’ve mastered the basics of grains, you can take things to the next level with some advanced techniques. These methods help automate more complex infrastructure logic and improve scalability.
Compound Targeting with Grains
You can combine multiple grains (and even other targeting types) to precisely select minions. For example:
salt -C 'G@role:webserver and G@env:production and not G@location:us-west' state.apply This command targets all production webservers except those in the US West region. Compound targeting lets you define fine-grained control over large infrastructures.
Grains in External Node Classification (ENC)
If you use an external system (like a CMDB or asset management tool), you can synchronize metadata into Salt grains automatically. Write Python scripts that pull data from APIs and set grains dynamically during minion startup.
Dynamic Grains Updating from Cloud Metadata
In cloud environments like AWS or Azure, grains can fetch data from instance metadata services. For instance, a dynamic grain might retrieve the EC2 instance type or availability zone, making your Salt states cloud-aware.
Integrating Grains with External Pillars
Combine grains and pillars for intelligent orchestration. For example, a pillar could define configuration templates for each environment, while grains decide which template to apply.
Auto-Classifying Minions
You can automate the classification of new minions based on their grain data. For example, when a new server joins, Salt can automatically detect its OS and assign it the correct role and environment without manual intervention.
These techniques turn grains from a static metadata feature into a powerful automation framework, enabling self-organizing, self-describing infrastructure.
Conclusion
SaltStack grains are much more than a collection of system facts—they’re the DNA of your infrastructure automation. They allow Salt to “understand” each system it manages, adapting configurations, deployments, and orchestrations intelligently. By leveraging grains effectively, you can make your infrastructure smarter, more dynamic, and infinitely more manageable.
From identifying OS types to creating custom classifications and advanced targeting, grains serve as the foundation of Salt’s adaptability. Whether you’re deploying across bare metal, virtual machines, or cloud instances, well-structured grain management ensures precision, consistency, and speed.
In short, mastering SaltStack grains means mastering SaltStack itself.
Searching for a skilled Linux admin? From server management to security, I ensure seamless operations for your Linux systems. Find out more on my Freelancer profile!
FAQs
Q1. What is the purpose of grains in SaltStack?
Grains provide system-level metadata (like OS, IP, and hardware details) that Salt uses for targeting and conditional configuration management.
Q2. How do I create custom grains?
You can create static custom grains by adding them under the grains: section in /etc/salt/minion, or dynamic grains using Python scripts in the _grains/ directory.
Q3. What’s the difference between grains and pillars?
Grains are local metadata about a system, while pillars are secure, master-defined data that can include sensitive information like credentials.
Q4. How can I refresh grains?
Use the following command to re-run grain modules and update cached values.
salt '*' saltutil.refresh_grainsQ5. Can grains be used for targeting specific minions?
Yes, you can use grain-based targeting with the -G flag to target only systems that match specific grain criteria. e.g.,
salt -G 'os:Ubuntu' test.pingRecommended Courses
If you want to master DevOps from beginner to advanced levels with hands-on projects, the “DevOps Beginners to Advanced with Projects” course by Imran Teli on Udemy is a great choice. It covers essential tools and techniques to boost your career and skills quickly. Check out the course through this link to start learning today.
Disclosure: Purchasing via this affiliate link may earn us a commission at no extra cost to you, helping support the Centlinux blog.

Leave a Reply
Please log in to post a comment.