cheat:salt
---
syntax: bash
tags: [ salt, saltstack ]
---
# Show pending keys to be accepted:
salt-key -L
# Accept all pending keys:
salt-key -A
# Accept pending key by name:
salt-key -a <target>
# Remove key by name:
salt-key -D <target>
# Test minion connection:
salt <target> test.ping
# Show active salt jobs
salt-run jobs.active
# Kill active job
salt <target> saltutil.kill_job <job_id>
# Copy small file (< 100kb) from master to minion
salt-cp <target> <source> <dest>
# Copy large file from master (/srv/salt/<source>) directory to minion
salt <target> cp.get_file salt://<source> <destination>
# Copy file from minion to master (will be stored at /var/cache/salt/master/minions/<minion_name>/files
salt <target> cp.push <source>
# Deploy state
salt <target> state.apply <state_name>
tldr:salt
# salt
# Execute commands and assert state on remote salt minions.
# More information: <https://docs.saltstack.com/ref/cli/salt.html>.
# List connected minions:
salt '*' test.ping
# Execute a highstate on all connected minions:
salt '*' state.highstate
# Upgrade packages using the OS package manager (apt, yum, brew) on a subset of minions:
salt '*.example.com' pkg.upgrade
# Execute an arbitrary command on a particular minion:
salt 'minion_id' cmd.run "ls "
$
cheat.sh