Demo Run Salt Stack Job

In the blog article Using SaltStack Config API (RaaS) I described how you can use the Salt Stack API and how you create a Workflow to run a Salt Stack Job. In this blog I will show you how you create a Job to install a Firefox on a Windows System.

  • vRA 8 with Salt Stack Config
  • pip3 installed on local environment
  • Internet Access on the Salt Stack Config Appliance
  • vRealize Orchestrator Workflow Salt Package impoted into Orchestrator (download here callSalt.zip (save the file as saltCall.package)
  • Installed Salt Minion(s) on Windows machine(s)

Log into the Salt Stack Config Appliance via Putty with the root account and perform the following commands.

pip3 install pygit2
salt-run winrepo.update_git_repos

The state files (sls) are stored under /srv/salt/win/repo-ng/salt-winrep-ng. The state files are used to install packages on Windows systems. These are pulled from a repo and you can add package state files as well as modify the files that are there.

Log into Salt Stack Config

  • Navigate to Config -> File Server
  • Select base from Saltenv
  • Enter /firefox/install_firefox-2-2.sls as path
  • Enter the code below
install_firefox:
  pkg.installed:
    - pkgs:
      - firefox_x86

The same should be done for the remove Firefox

  • Navigate to Config -> File Server
  • Select base from Saltenv
  • Enter /firefox/remove_firefox-2.sls as path
  • Enter the code below
remove_firefox:
  pkg.removed:
    - pkgs:
      - firefox_x86
  • Click on SAVE
  • Navigate to Config -> Jobs
  • Click on CREATE JOB button
  • Enter a name
  • Enter a description
  • Select salt as command
  • Select Windows as target
  • Select state.apply as function
  • Select base as environment
  • Select firefox.instell_firefox-2-2 as states
  • Leave run as test blanc
  • Click on SAVE
  • Navigate to Config -> Jobs
  • Click on CREATE JOB button
  • Enter a name
  • Enter a description
  • Select salt as command
  • Select Windows as target
  • Select state.apply as function
  • Select base as environment
  • Select firefox.remove_firefox-2 as states
  • Leave run as test blanc
  • Click on SAVE
Get Job ID
  • Log into Salt Stack Config
  • Navigate to Config -> Jobs
  • Select and open the Job where to plan to run
  • In the URL you will find the JOB FERCH@NET4.FUTURE.DE as shown below
Run Job via vRealize Orchestrator
  • Log into vRealize Orchestrator Service
  • Navigate to Library -> Workflows -> hferch -> SALT
  • Run the Workflow “Run Salt Stack Config Job By ID”
  • Provide the inputs
  • Click RUN

Similar Posts

Leave a Reply

Your email address will not be published.

WC Captcha 35 + = 39