Saltstack platform notes

From wikinotes

general

targeting multiple platforms

use grains['os_family'] to target a range of platforms

RedHat:
  - CentOS
  - RedHat

Windows:
  - Windows

Debian:
  - Debian
  - Ubuntu

Arch:
  - Archlinux

Windows:
  - Windows

FreeBSD:
  - FreeBSD

MacOS:
  - MacOS

NOTE:

All `os_family` types can be found in /usr/lib/python2.7/site-packages/salt/grains/core.py in the variable _OS_FAMILY_MAP .

platforms

grains.kernel

grains['kernel']
  Linux
  Windows

Windows

  • use chocolatey instead of saltrepo (pkg.installed). It is more simple, dependable, and supports more packages.
  • binaries installed to C:/salt/bin
  • can use in powershell or git-bash
cd /c/salt
./salt-call.bat   state.apply   progs.shell.tmux
  • salt-coloured output available:
Start Menu:
    - type powershell
    - Shift + Rclick result >  Run as Administrator
    - C:/salt/salt-call -l debug --force-color --state-output=mixed test.ping > log; cat log   ## cat log will properly display coloured output.

MacOS

  • pkg.installed refers to macports

(possibly because I installed salt from macports)