Lab 1: Check Network Connections
Scenario
IT system administrator or DevOps team member often needs to remote login to the nodes (minions) and run commands for data collection or health check. You’ll learn how to use Automation Config to run remote commands effectively to group of nodes (target of minions) without the need to login to each node.
Task A. Run Command on a Minion
- Click Targets in the side menu to open the Targets workspace and view your targets

- Click Windows to show Minions in the Windows target
- Select the first Windows Minion

- Click RUN COMMAND to open Run Command dialog box
- Input the following details
- Command =
salt
- Function =
cmd.run
- Arguments =
netstat

- Click RUN COMMAND to confirm
- Click Activity > In Progress in the side menu to check progress of execution job
- Click Activity > Completed in the side menu
- The job will appear on the list once it is done. If not, Refresh the page in your browser

- Click the JID value of the completed job to show job summary
- Click the double arrow icon to expand for additional information
- Click CMD to show output of the command
- Click the arrow to show details

- Click Raw to show raw JSON output
Task B. Create Target (Group of Minions)
- Click Targets in the side menu to open the Targets workspace and view your targets

- Click Create button
- Input the following details
- Name =
My Servers
- Description =
My Windows & Linux Workload
- All masters = (Checked)
- Criteria
- Target type (1) =
Grain
- Grain key (1) =
osfinger
- Grain value (1) =
Windows-2019Server
- Click Add Match Criteria
- Conjunction (2) =
OR
- Target type (2) =
Grain
- Grain key (2) =
nodename
- Grain value (2) =
saltminion-ubu20

- Click Save button
- New Target is created successfully. Minions matching the criteria are shown

Task C. Run SaltStack Command at Target (Minion Group)
- Click Targets in the side menu to open the Targets workspace and view your targets
- Locate My Servers target

- Click the
button besides My Server and select Run command

- In the Run Command dialog box
- Input the following details
- Command =
salt
- Function =
network.netstat
- Arguments = (Blank)

- Click RUN COMMAND button to confirm
- Click Activity > Completed in the side menu
- The job will appear on the list once it is done. If not, Refresh the page in your browser
- Click the JID value of the completed job to show job summary
- Click Network Netstat tab to show results in tabular format

- Click Download > JSON button to export the results as JSON file

Summary
As you review the job results, consider the following points:
- Notice that SaltStack functions, e.g. network.ping, network.netstat, disk.usage are cross-platform comparing to native OS commands via cmd.run. You’ll get the same result no matter which operating system the minion is running (Windows, Linux, MacOS, etc.). Automation Config is designed to work with nearly every operating system.
- Target management is essential for efficient operations automation. It is worhty to spend more time on designing your own targets, so that you could use them later for commands or jobs. More importantly, you will be able to manage role-based access based on role permissions for each target.
- Automation Config also gives you the ability to run this job on a schedule and to publish it into an exportable report.