{"id":20390049,"url":"https://github.com/martinrusev/saltstack-cheatsheet","last_synced_at":"2026-03-08T06:33:06.525Z","repository":{"id":33829511,"uuid":"37528057","full_name":"martinrusev/saltstack-cheatsheet","owner":"martinrusev","description":"SaltStack Cheat Sheet","archived":false,"fork":false,"pushed_at":"2015-06-17T09:15:07.000Z","size":152,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-14T05:18:15.325Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinrusev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-16T12:15:35.000Z","updated_at":"2023-05-01T04:58:50.000Z","dependencies_parsed_at":"2022-07-24T18:02:00.075Z","dependency_job_id":null,"html_url":"https://github.com/martinrusev/saltstack-cheatsheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/martinrusev/saltstack-cheatsheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fsaltstack-cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fsaltstack-cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fsaltstack-cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fsaltstack-cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinrusev","download_url":"https://codeload.github.com/martinrusev/saltstack-cheatsheet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fsaltstack-cheatsheet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30247374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T05:41:50.788Z","status":"ssl_error","status_checked_at":"2026-03-08T05:41:39.075Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T03:21:56.547Z","updated_at":"2026-03-08T06:33:06.463Z","avatar_url":"https://github.com/martinrusev.png","language":null,"readme":"# SaltStack Cheat Sheet\n\n\n**Table of Contents** \n\n- [Initial Configuration](#initial-configuration)\n- [Minions](#minions)\n  - [Minion status](#minion-status)\n  - [Target minion with state files](#target-minion-with-state-files)\n  - [Grains](#grains)\n- [Jobs in Salt](#jobs-in-salt)\n- [Sysadmin specific](#sysadmin-specific)\n  - [System and status](#system-and-status)\n  - [Packages](#packages)\n  - [Check status of a service and manipulate services](#check-status-of-a-service-and-manipulate-services)\n\n# Initial Configuration\nIn `/etc/salt/master` delete all the entries, in the beginning you only need the following: \n\n```\ninterface: 0.0.0.0\nmax_open_files: 100000\nfile_roots:\n  base:\n    - /salt/states/base\n```\n\nMinion configuration `/etc/salt/minion`, the bare minimum: \n\n```\nmaster: master_ip\n#id:\n```\n\n# Minions\n\n## Minion status\nYou can also use several commands to check if minions are alive and kicking but I prefer manage.status/up/down.\n\n```\nsalt-run manage.status  # What is the status of all my minions? (both up and down)\nsalt-run manage.up      # Any minions that are up?\nsalt-run manage.down    # Any minions that are down?\nsalt '*' test.ping      # Use test module to check if minion is up and responding.\n                        # (Not an ICMP ping!)\n```\n\n## Target minion with state files\nApply a specific state file to a (group of..) minion(s). Do not use the .sls extension. (just like in the state files!)\n\n```\nsalt '*' state.sls mystatefile           # mystatefile.sls will be applied to *\nsalt 'minion1' state.sls prod.somefile  # prod/somefile.sls will be applied to minion1\n```\n\nGrouping minions by id in /etc/salt/master\n\n\n```\nnodegroups:\n  deb: 'debian8, ubuntu1404'\n  rpm: 'centos7, centos6'\n\nsalt -N deb state.sls vim\n```\n\n\n## Grains\n\nList all grains on all minions\n\n```\nsalt '*' grains.ls\n```\n\nLook at a single grains item to list the values.\n\n```\nsalt '*' grains.item os      # Show the value of the OS grain for every minion\nsalt '*' grains.item roles   # Show the value of the roles grain for every minion\n```\n\nManipulate grains.\n\n```\nsalt 'minion1' grains.setval mygrain True  # Set mygrain to True (create if it doesn't exist yet)\nsalt 'minion1' grains.delval mygrain       # Delete the value of the grain\n```\n\n# Jobs in Salt\nSome jobs operations that are often used. (http://docs.saltstack.com/en/latest/topics/jobs/)\n\n```\nsalt-run jobs.active      # get list of active jobs\nsalt-run jobs.list_jobs   # get list of historic jobs\nsalt-run jobs.lookup_jid \u003cjob id number\u003e  # get details of this specific job\n```\n\n# Sysadmin specific\nSome stuff that is specifically of interest for sysadmins.\n\n## System and status\n```\nsalt 'minion-x-*' system.reboot  # Let's reboot all the minions that match minion-x-*\nsalt '*' status.uptime           # Get the uptime of all our minions\n```\n\n## Packages\n\n```\nsalt '*' pkg.list_upgrades             # get a list of packages that need to be upgrade\nsalt '*' pkg.upgrade                   # Upgrades all packages via apt-get dist-upgrade (or similar)\n\nsalt '*' pkg.version bash              # get current version of the bash package\nsalt '*' pkg.install bash              # install or upgrade bash package\nsalt '*' pkg.install bash refresh=True # install or upgrade bash package but\n                                      # refresh the package database before installing.\n```\n\n## Check status of a service and manipulate services\n\n```\nsalt '*' service.status \u003cservice name\u003e\nsalt '*' service.available \u003cservice name\u003e\nsalt '*' service.start \u003cservice name\u003e\nsalt '*' service.restart \u003cservice name\u003e\nsalt '*' service.stop \u003cservice name\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinrusev%2Fsaltstack-cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinrusev%2Fsaltstack-cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinrusev%2Fsaltstack-cheatsheet/lists"}