Example
This example demonstrates how to structure a SaltStack workflow in SystemLink to conditionally reboot a Windows system and then install and configure OpenSSH Server. The same pattern can be adapted for other software installations that require a reboot beforehand.
Reboot_System.sls
This state ensures that the system is rebooted before the software installation.
reboot_system:
module.run:
- name: system.reboot
- in_seconds: true
- order: first
- timeout: 60
- wait_for_reboot: true
Install_OpenSSH_Server.sls
This state installs and configures the OpenSSH Server using PowerShell commands. You can replace this logic with any other software installation steps.
install_openssh_server:
cmd.run:
- name: >
Set-ExecutionPolicy Unrestricted;
Add-WindowsCapability -Online -Name 'OpenSSH.Server~~~~0.0.1.0';
Set-Service -Name sshd -StartupType Automatic;
Start-Service sshd;
- shell: powershell
Main.sls
This is the entry-point state that includes the two modular states above. When deployed, SystemLink will execute them in order and track each step individually.
include:
- Reboot_System
- Install_OpenSSH_Server
To deploy this example, follow the general deployment steps outlined earlier.