salt.states.pkgrepo

Management of package repos

Package repositories can be managed with the pkgrepo state:

base:
  pkgrepo.managed:
    - human_name: CentOS-$releasever - Base
    - mirrorlist: http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    - comments:
        - #http://mirror.centos.org/centos/$releasever/os/$basearch/
    - gpgcheck: 1
    - gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
salt.states.pkgrepo.absent(name, **kwargs)

This function deletes the specified repo on the system, if it exists. It is essentially a wrapper around pkg.del_repo.

name
The name of the package repo, as it would be referred to when running the regular package manager commands.
ppa

On Ubuntu, you can take advantage of Personal Package Archives on Launchpad simply by specifying the user and archive name.

EXAMPLE: ppa: wolfnet/logstash
ppa_auth

For Ubuntu PPAs there can be private PPAs that require authentication to access. For these PPAs the username/password can be specified. This is required for matching if the name format uses the "ppa:" specifier and is private (requires username/password to access, which is encoded in the URI)

EXAMPLE: ppa_auth: username:password
salt.states.pkgrepo.managed(name, **kwargs)

This function manages the configuration on a system that points to the repositories for the system's package manager.

name
The name of the package repo, as it would be referred to when running the regular package manager commands.

For yum-based systems, take note of the following configuration values:

humanname
On yum-based systems, this is stored as the "name" value in the .repo file in /etc/yum.repos.d/. On yum-based systems, this is required.
baseurl
On yum-based systems, baseurl refers to a direct URL to be used for this yum repo. One of baseurl or mirrorlist is required.
mirrorlist
a URL which contains a collection of baseurls to choose from. On yum-based systems. One of baseurl or mirrorlist is required.
comments
Sometimes you want to supply additional information, but not as enabled configuration. Anything supplied for this list will be saved in the repo configuration with a comment marker (#) in front.

Additional configuration values, such as gpgkey or gpgcheck, are used verbatim to update the options for the yum repo in question.

For apt-based systems, take note of the following configuration values:

ppa

On Ubuntu, you can take advantage of Personal Package Archives on Launchpad simply by specifying the user and archive name. The keyid will be queried from launchpad and everything else is set automatically. You can override any of the below settings by simply setting them as you would normally.

EXAMPLE: ppa: wolfnet/logstash
ppa_auth

For Ubuntu PPAs there can be private PPAs that require authentication to access. For these PPAs the username/password can be passed as an HTTP Basic style username/password combination.

EXAMPLE: ppa_auth: username:password
name

On apt-based systems this must be the complete entry as it would be seen in the sources.list file. This can have a limited subset of components (i.e. 'main') which can be added/modified with the "comps" option.

EXAMPLE: name: deb http://us.archive.ubuntu.com/ubuntu/ precise main
disabled
On apt-based systems, disabled toggles whether or not the repo is used for resolving dependencies and/or installing packages
comps
On apt-based systems, comps dictate the types of packages to be installed from the repository (e.g. main, nonfree, ...). For purposes of this, comps should be a comma-separated list.
file
The filename for the .list that the repository is configured in. It is important to include the full-path AND make sure it is in a directory that APT will look in when handling packages
dist
This dictates the release of the distro the packages should be built for. (e.g. unstable)
keyid
The KeyID of the GPG key to install. This option also requires the 'keyserver' option to be set.
keyserver
This is the name of the keyserver to retrieve gpg keys from. The keyid option must also be set for this option to work.
key_url
A web URL to retrieve the GPG key from.
consolidate
If set to true, this will consolidate all sources definitions to the sources.list file, cleanup the now unused files, consolidate components (e.g. main) for the same URI, type, and architecture to a single line, and finally remove comments from the sources.list file. The consolidate will run every time the state is processed. The option only needs to be set on one repo managed by salt to take effect.
require_in
Set this to a list of pkg.installed or pkg.latest to trigger the running of apt-get update prior to attempting to install these packages. Setting a require in the pkg will not work for this.

Table Of Contents

Previous topic

salt.states.pkg

Next topic

salt.states.postgres_database