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

  1. Click Targets in the side menu to open the Targets workspace and view your targets Targets workspace
  2. Click Windows to show Minions in the Windows target
  3. Select the first Windows Minion Minions in the Windows target
  4. Click RUN COMMAND to open Run Command dialog box
    • Input the following details
      • Command = salt
      • Function = cmd.run
      • Arguments = netstat Run Command dialog box
  5. Click RUN COMMAND to confirm
  6. Click Activity > In Progress in the side menu to check progress of execution job
  7. 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 Completed Jobs
  8. Click the JID value of the completed job to show job summary
  9. Click the double arrow icon to expand for additional information
  10. Click CMD to show output of the command
    • Click the arrow to show details CMD Results
  11. Click Raw to show raw JSON output

Task B. Create Target (Group of Minions)

  1. Click Targets in the side menu to open the Targets workspace and view your targets Target workspace
  2. 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 Create Target
  3. Click Save button
  4. New Target is created successfully. Minions matching the criteria are shown Target Created

Task C. Run SaltStack Command at Target (Minion Group)

  1. Click Targets in the side menu to open the Targets workspace and view your targets
  2. Locate My Servers target Targets
  3. Click the button besides My Server and select Run command kebab menu > Run command
  4. In the Run Command dialog box
    • Input the following details
      • Command = salt
      • Function = network.netstat
      • Arguments = (Blank) Run Command dialog box
  5. Click RUN COMMAND button to confirm
  6. Click Activity > Completed in the side menu
  7. The job will appear on the list once it is done. If not, Refresh the page in your browser
  8. Click the JID value of the completed job to show job summary
  9. Click Network Netstat tab to show results in tabular format Network Netstat results
  10. Click Download > JSON button to export the results as JSON file Export 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.