I recently worked on an installed SaltStack environment which was installed by someone who no longer works for the company. SaltStack is used to configure our Hyper-V virtual machines.
Covered here is my experience based an a couple of days of limited knowledge of reading the SaltStack docs and looking at our local States and WinRepo repository. This is definitely not a guide but just some notes I captured while taking a break from banging my head against the brick wall.
Create your Windows virtual machine
Working with Windows is awkward so you can't just use your favourite provisioning tool like vagrant to get started. You have to build a Windows Virtual Machine by hand (grin and bear it I'm afraid). I have an MSDN subscription so I can download ISO's and get licence keys. If you are not fortunate to have an MSDN subscription you can download evaluations here: https://www.microsoft.com/en-us/evalcenter/
Although possible to run Salt minion master-less on your local machine I recommend a virtual environment (Hyper-V for me; VirtualBox if you are looking) so that you can snapshot before running any Salt States; and restore if necessary. You don't want to destroy your local environment and install software that you do not want.
Install Salt Minion
See Installing Salt Minion to download and installed.
Ensure to set your Salt-Minion service is stopped and disabled after installation.
stop-service salt-minion set-service salt-minion -StartupType disabled
Clone the SaltStates and WinRepo repository
I cloned my two repositories to:
Modify SaltMaster Config
Below are the changes I made to
file_client: local win_gitrepos: - C:/salty/saltstack-winrepo win_repo: C:/salty/saltstack-winrepo win_repo_cachefile: 'C:/salty/foo/winrepo.p' grains: node_type: devwindows
When you satisfied everything is configured, you need to generate winrepo.p
My winrepo backs onto a local artifactory repository which is storing our required artefacts.
> salt-call winrepo.genrepo repo: ---------- 7zip: ---------- 9.20.00.0: ---------- full_name: 7-Zip 9.20 (x64 edition) install_flags: /q installer: http://artifacts/simple/vendor-local/7Zip/9.20/7z920-x64.msi msiexec: True reboot: False uninstall_flags: /qn uninstaller: http://artifacts/simple/vendor-local/7Zip/9.20/7z920-x64.msi WindowsSDK: ---------- 7.1.7600.0.30514: ---------- full_name: Microsoft Windows SDK for Windows 7 (7.1) install_flags: -q -params:ADDLOCAL=ALL installer: C:\windows_sdk_7_1_files\setup.exe msiexec: False reboot: False buildtools: ---------- 12.0.21005.1: ---------- full_name: Microsoft Build Tools 2013 install_flags: /quiet /norestart installer: http://artifacts/simple/vendor-local/Microsoft/BuildTools/2013/BuildTools-2013.exe msiexec: False reboot: False uninstall_flags: /uninstall /quiet /norestart uninstaller: http://artifacts/simple/vendor-local/Microsoft/BuildTools/2013/BuildTools-2013.exe
Above is just a sample of the output. When successful you'll see a Json like structure of your WinRepo in the output.
A simple grain
I modified the top.sls file and added my own grain.
'node_type:devwindows': - match: grain - 7zip
I followed the matching grains example: http://docs.saltstack.com/en/latest/topics/targeting/grains.html#matching-grains-in-the-top-file
salt-call state.highstate and 7-Zip got installed.
This means I can test my States, Pillars and my Grains without destroying the environment by committing malformed YAML files!