Skip to main content
SaltStack Support

Deleting A Salt Master

You may need to delete a Salt master to either (1) remove it from service, or (2) change the Salt master ID. There is no current mechanism to delete an Enterprise master, so you will need to go directly to the Enterprise API.

When a master is deleted from the Enterprise API, the following data connected to that Salt master is also deleted:

  • minion data
    • grains
    • key state
    • "minions expected" data on jobs
    • matching minions per target group
  • job returns
  • matching "masters to" and "masters done" entries on commands
  • master information on target groups
  • master information on jobs
  • master config entries
  • master file system entries

How to Delete a Salt Master

If you have XSRF enabled (the default), you'll need to store the cookie set by the server, and then retrieve the XSRF token from the cookie. The following is an example of connecting and storing the cookie:

curl -k -c ~/eAPICookie.txt -u {{ eAPI_User }}:{{ eAPI_PWD }} 'http://localhost/version' >/dev/null

After you have stored the cookie, you can retrieve the XSRF token to include with subsequent calls to the API. The following example deletes a Salt master from Enterprise API.

Be very careful with this command since there is no delete confirmation and the data is immediately removed!
curl -k -u root:salt -b ~/eAPICookie.txt -H 'X-Xsrftoken: '$(grep -w '_xsrf' ~/eAPICookie.txt | cut -f7)'' 
-X DELETE 'https://localhost/master/{{ MASTER_ID }}'

eAPI_User: Username that has privileges to the Enterprise API, for example "root".
eAPI_PWD: Password associated with eAPI_User.
Master_ID: ID of the Salt master that you want to delete. 

If you do not have XSRF enabled, you do not need to store the cookie:

curl -sSik -X DELETE https://localhost/master/{{ MASTER_ID }} -u {{ eAPI_User }}:{{ eAPI_PWD }}
  • Was this article helpful?