Salt stack cheatsheet

Command Line Interface (CLI) Commands

  • salt <target> <function> [arguments]: Runs a function on one or more Salt minions.
  • salt-key [-L] [-A <keyname>] [-D <keyname>]: Manages Salt minion keys.
  • salt-call <function> [arguments]: Runs a Salt function locally on the Salt master.

Basic Salt States

  • pkg: Manages software packages on minions.
  • file: Manages files and directories on minions.
  • service: Manages system services on minions.
  • user: Manages users and groups on minions.

Jinja Templating Language

  • {% if <condition> %}: Conditionally includes or excludes content based on a given condition.
  • {{ <expression> }}: Outputs the value of a given expression.
  • {% for <item> in <collection> %}: Iterates over a given collection and includes content for each item.

Pillar Data

  • Pillar data is used to provide configuration data to Salt minions.
  • Pillar data is stored in separate YAML files and can be targeted to specific minions or groups of minions.
  • Pillar data can be encrypted for added security.

Grains

  • Grains are system-level information that are collected by Salt minions and stored on the Salt master.
  • Grains can be used to target specific minions based on their system characteristics (e.g. OS, CPU architecture, etc.).
  • Grains can also be used in Salt states and Jinja templates.

Modules

  • Salt modules are functions that can be executed on Salt minions.
  • Salt modules can be written in a variety of programming languages, including Python, Ruby, and Bash.
  • Salt includes many built-in modules, and additional modules can be created and shared by the Salt community.

Highstate

  • The Salt Highstate is a collection of Salt states that are applied to a group of Salt minions.
  • The Highstate can be used to ensure that a group of minions have a consistent configuration.
  • The Highstate can be executed manually or scheduled to run at regular intervals.

Leave a Reply

Your email address will not be published. Required fields are marked *