Installing SPM Packages

SPM packages are installed to your Salt master, where they are available to Salt minions using all of Salt's package management functions.

Configuring Remote Repositories

Before SPM can use a repository, two things need to happen. First, the Salt master needs to know where the repository is through a configuration process. Then it needs to pull down the repository metadata.

Repository Configuration Files

Repositories are configured by adding each of them to the /etc/salt/spm.repos.d/spm.repo file on each Salt master. This file contains the name of the repository, and the link to the repository:

my_repo:
  url: https://spm.example.com/

The URL can use http, https, ftp, or file.

my_repo:
  url: file:///srv/spm_build

Updating Local Repository Metadata

After the repository is configured on the Salt master, repository metadata is downloaded using the spm update_repo command:

spm update_repo

注解

A file for each repo is placed in /var/cache/salt/spm on the Salt master after you run the update_repo command. If you add a repository and it does not seem to be showing up, check this path to verify that the repository was found.

Update File Roots

SPM packages are installed to the srv/spm/salt folder on your Salt master. This path needs to be added to the file roots on your Salt master manually.

file_roots:
  base:
    1. /srv/salt
    2. /srv/spm/salt

Restart the salt-master service after updating the file_roots setting.

Installing Packages

To install a package, use the spm install command:

spm install apache

警告

Currently, SPM does not check to see if files are already in place before installing them. That means that existing files will be overwritten without warning.

Installing directly from an SPM file

You can also install SPM packages using a local SPM file using the spm local install command:

spm local install /srv/spm/apache-201506-1.spm

An SPM repository is not required when using spm local install.

Pillars

If an installed package includes Pillar data, be sure to target the installed pillar to the necessary systems using the pillar Top file.

Removing Packages

Packages may be removed after they are installed using the spm remove command.

spm remove apache

If files have been modified, they will not be removed. Empty directories will also be removed.