neulab/tldr huggingface dataset:
csr:   A file or PEM string containing a certificate signing request. This will be used to supply the subject, extensions and public key of a certificate. Any subject or extensions specified explicitly will overwrite any in the CSR.
basicConstraints: X509v3 Basic Constraints extension.
extensions: The following arguments set X509v3 Extension values. If the value starts with critical, the extension will be marked as critical.
Some special extensions are subjectKeyIdentifier and authorityKeyIdentifier.
subjectKeyIdentifier can be an explicit value or it can be the special string hash. hash will set the subjectKeyIdentifier equal to the SHA1 hash of the modulus of the public key in this certificate. Note that this is not the exact same hashing method used by OpenSSL when using the hash value.
authorityKeyIdentifier Use values acceptable to the openssl CLI tools. This will automatically populate authorityKeyIdentifier with the subjectKeyIdentifier of signing_cert. If this is a self-signed cert these values will be the same.
basicConstraints: X509v3 Basic Constraints
keyUsage: X509v3 Key Usage
extendedKeyUsage: X509v3 Extended Key Usage
subjectKeyIdentifier: X509v3 Subject Key Identifier
issuerAltName: X509v3 Issuer Alternative Name
subjectAltName: X509v3 Subject Alternative Name
crlDistributionPoints: X509v3 CRL Distribution Points
issuingDistributionPoint: X509v3 Issuing Distribution Point
certificatePolicies: X509v3 Certificate Policies
policyConstraints: X509v3 Policy Constraints
inhibitAnyPolicy: X509v3 Inhibit Any Policy
nameConstraints: X509v3 Name Constraints
noCheck: X509v3 OCSP No Check
nsComment: Netscape Comment
nsCertType: Netscape Certificate Type
days_valid: The number of days this certificate should be valid. This sets the notAfter property of the certificate. Defaults to 365.
version: The version of the X509 certificate. Defaults to 3. This is automatically converted to the version value, so version=3 sets the certificate version field to 0x2.
serial_number: The serial number to assign to this certificate. If omitted a random serial number of size serial_bits is generated.
serial_bits: The number of bits to use when randomly generating a serial number.  Defaults to 64.
algorithm: The hashing algorithm to be used for signing this certificate.  Defaults to sha256.
copypath: An additional path to copy the resulting certificate to. Can be used to maintain a copy of all certificates issued for revocation purposes.
prepend_cn: If set to True, the CN and a dash will be prepended to the copypath's filename.
Example: /etc/pki/issued_certs/www.example.com-DE:CA:FB:AD:00:00:00:00.crt
signing_policy: A signing policy that should be used to create this certificate.  Signing policies should be defined in the minion configuration, or in a minion pillar. It should be a YAML formatted list of arguments which will override any arguments passed to this function. If the minions key is included in the signing policy, only minions matching that pattern (see match.glob and match.compound) will be permitted to remotely request certificates from that policy.  In order to match.compound to work salt master must peers permit peers to call it.
peer: .*: - match.compound
x509_signing_policies: www: - minions: 'www*' - signing_private_key: /etc/pki/ca.key - signing_cert: /etc/pki/ca.crt - C: US - ST: Utah - L: Salt Lake City - basicConstraints: "critical CA:false" - keyUsage: "critical cRLSign, keyCertSign" - subjectKeyIdentifier: hash - authorityKeyIdentifier: keyid,issuer:always - days_valid: 90 - copypath: /etc/pki/issued_certs/
The above signing policy can be invoked with signing_policy=www
not_before: Initial validity date for the certificate. This date must be specified in the format '%Y-%m-%d %H:%M:%S'.
not_after: Final validity date for the certificate. This date must be specified in the format '%Y-%m-%d %H:%M:%S'.
salt '*' x509.create_certificate path=/etc/pki/myca.crt signing_private_key='/etc/pki/myca.key' csr='/etc/pki/myca.csr'}
salt.modules.x509.create_crl(path=None, text=False, signing_private_key=None, signing_private_key_passphrase=None, signing_cert=None, revoked=None, include_expired=False, days_valid=100, digest='') Create a CRL
• PyOpenSSL Python module
path:  Path to write the CRL to.
signing_private_key: A path or string of the private key in PEM format that will be used to sign the CRL. This is required.
signing_private_key_passphrase: Passphrase to decrypt the private key.
signing_cert: A certificate matching the private key that will be used to sign the CRL. This is required.
revoked: A list of dicts containing all the certificates to revoke. Each dict represents one certificate. A dict must contain either the key serial_number with the value of the serial number to revoke, or certificate with either the PEM encoded text of the certificate, or a path to the certificate to revoke.
The dict can optionally contain the revocation_date key. If this key is omitted the revocation date will be set to now. If should be a string in the format "%Y-%m-%d %H:%M:%S".
The dict can also optionally contain the not_after key. This is redundant if the certificate key is included. If the Certificate key is not included, this can be used for the logic behind the include_expired parameter. If should be a string in the format "%Y-%m-%d %H:%M:%S".
The dict can also optionally contain the reason key. This is the reason code for the revocation. Available choices are unspecified, keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation and certificateHold.
include_expired: Include expired certificates in the CRL. Default is False.
days_valid: The number of days that the CRL should be valid. This sets the Next Update field in the CRL.
digest: The digest to use for signing the CRL.  This has no effect on versions of pyOpenSSL less than 0.14
salt '*' x509.create_crl path=/etc/pki/mykey.key \ signing_private_key=/etc/pki/ca.key \ signing_cert=/etc/pki/ca.crt \ revoked="{'compromized-web-key': {'certificate': '/etc/pki/certs/www1.crt', 'revocation_date': '2015-03-01 00:00:00'}}"
salt.modules.x509.create_csr(path=None, text=False, **kwargs) Create a certificate signing request.
algorithm: The hashing algorithm to be used for signing this request. Defaults to sha256.
kwargs: The subject, extension and version arguments from x509.create_certificate can be used.
salt '*' x509.create_csr path=/etc/pki/myca.csr public_key='/etc/pki/myca.key' CN='My Cert'
salt.modules.x509.create_private_key(path=None, text=False, bits=2048, passphrase=None, cipher='aes_128_cbc', verbose=True) Creates a private key in PEM format.
path:  The path to write the file to, either path or text are required.
bits:  Length of the private key in bits. Default 2048
passphrase: Passphrase for encrypting the private key
cipher: Cipher for encrypting the private key. Has no effect if passphrase is None.
verbose: Provide visual feedback on stdout. Default True
salt '*' x509.create_private_key path=/etc/pki/mykey.key
salt.modules.x509.expired(certificate) Returns a dict containing limited details of a certificate and whether the certificate has expired.
certificate: The certificate to be read. Can be a path to a certificate file, or a string containing the PEM formatted text of the certificate.
salt '*' x509.expired "/etc/pki/mycert.crt"
salt.modules.x509.get_pem_entries(glob_path) Returns a dict containing PEM entries in files matching a glob
glob_path: A path to certificates to be read and returned.
salt '*' x509.get_pem_entries "/etc/pki/*.crt"
salt.modules.x509.get_pem_entry(text, pem_type=None) Returns a properly formatted PEM string from the input text fixing any whitespace or line-break issues
text:  Text containing the X509 PEM entry to be returned or path to a file containing the text.
pem_type: If specified, this function will only return a pem of a certain type, for example 'CERTIFICATE' or 'CERTIFICATE REQUEST'.
salt '*' x509.get_pem_entry "-----BEGIN CERTIFICATE REQUEST-----MIICyzCC Ar8CAQI...-----END CERTIFICATE REQUEST"
salt.modules.x509.get_private_key_size(private_key, passphrase=None) Returns the bit length of a private key in PEM format.
private_key: A path or PEM encoded string containing a private key.
salt '*' x509.get_private_key_size /etc/pki/mycert.key
salt.modules.x509.get_public_key(key, passphrase=None, asObj=False) Returns a string containing the public key in PEM format.
key:   A path or PEM encoded string containing a CSR, Certificate or Private Key from which a public key can be retrieved.
salt '*' x509.get_public_key /etc/pki/mycert.cer
salt.modules.x509.get_signing_policy(signing_policy_name) Returns the details of a names signing policy, including the text of the public key that will be used to sign it. Does not return the private key.
salt '*' x509.get_signing_policy www
salt.modules.x509.read_certificate(certificate) Returns a dict containing details of a certificate. Input can be a PEM string or file path.
salt '*' x509.read_certificate /etc/pki/mycert.crt
salt.modules.x509.read_certificates(glob_path) Returns a dict containing details of all certificates matching a glob
salt '*' x509.read_certificates "/etc/pki/*.crt"
salt.modules.x509.read_crl(crl) Returns a dict containing details of a certificate revocation list.  Input can be a PEM string or file path.
• OpenSSL command line tool
crl:   A path or PEM encoded string containing the CRL to read.
salt '*' x509.read_crl /etc/pki/mycrl.crl
salt.modules.x509.read_csr(csr) Returns a dict containing details of a certificate request.
csr:   A path or PEM encoded string containing the CSR to read.
salt '*' x509.read_csr /etc/pki/mycert.csr
salt.modules.x509.sign_remote_certificate(argdic, **kwargs) Request a certificate to be remotely signed according to a signing policy.
argdic: A dict containing all the arguments to be passed into the create_certificate function. This will become kwargs when passed to create_certificate.
kwargs: kwargs delivered from publish.publish
salt '*' x509.sign_remote_certificate argdic="{'public_key': '/etc/pki/www.key', 'signing_policy': 'www'}" __pub_id='www1'
salt.modules.x509.verify_crl(crl, cert) Validate a CRL against a certificate.  Parses openssl command line output, this is a workaround for M2Crypto's inability to get them from CSR objects.
crl:   The CRL to verify
cert:  The certificate to verify the CRL against
salt '*' x509.verify_crl crl=/etc/pki/myca.crl cert=/etc/pki/myca.crt
salt.modules.x509.verify_private_key(private_key, public_key, passphrase=None) Verify that 'private_key' matches 'public_key'
private_key: The private key to verify, can be a string or path to a private key in PEM format.
public_key: The public key to verify, can be a string or path to a PEM formatted certificate, CSR, or another private key.
passphrase: Passphrase to decrypt the private key.
salt '*' x509.verify_private_key private_key=/etc/pki/myca.key \ public_key=/etc/pki/myca.crt
salt.modules.x509.verify_signature(certificate, signing_pub_key=None, signing_pub_key_passphrase=None) Verify that certificate has been signed by signing_pub_key
certificate: The certificate to verify. Can be a path or string containing a PEM formatted certificate.
signing_pub_key: The public key to verify, can be a string or path to a PEM formatted certificate, CSR, or private key.
signing_pub_key_passphrase: Passphrase to the signing_pub_key if it is an encrypted private key.
salt '*' x509.verify_signature /etc/pki/mycert.pem \ signing_pub_key=/etc/pki/myca.crt
salt.modules.x509.will_expire(certificate, days) Returns a dict containing details of a certificate and whether the certificate will expire in the specified number of days.  Input can be a PEM string or file path.
salt '*' x509.will_expire "/etc/pki/mycert.crt" days=30
salt.modules.x509.write_pem(text, path, overwrite=True, pem_type=None) Writes out a PEM string fixing any formatting or whitespace issues before writing.
text:  PEM string input to be written out.
path:  Path of the file to write the PEM out to.
overwrite: If True (default), write_pem will overwrite the entire PEM file.  Set False to preserve existing private keys and dh params that may exist in the PEM file.
pem_type: The PEM type to be saved, for example CERTIFICATE or PUBLIC KEY. Adding this will allow the function to take input that may contain multiple PEM types.
salt '*' x509.write_pem "-----BEGIN CERTIFICATE-----MIIGMzCCBBugA..." path=/etc/pki/mycert.crt
salt.modules.xapi_virt This module (mostly) uses the XenAPI to manage Xen virtual machines.
Big fat warning: the XenAPI used in this file is the one bundled with Xen Source, NOT XenServer nor Xen Cloud Platform. As a matter of fact it will fail under those platforms. From what I've read, little work is needed to adapt this code to XS/XCP, mostly playing with XenAPI version, but as XCP is not taking precedence on Xen Source on many platforms, please keep compatibility in mind.
Useful documentation:
. http://downloads.xen.org/Wiki/XenAPI/xenapi-1.0.6.pdf . http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/ . https://github.com/xapi-project/xen-api/tree/master/scripts/examples/python . http://xenbits.xen.org/gitweb/?p=xen.git;a=tree;f=tools/python/xen/xm;hb=HEAD
salt.modules.xapi_virt.freecpu() Return an int representing the number of unallocated cpus on this hypervisor
salt.modules.xapi_virt.freemem() Return an int representing the amount of memory that has not been given to virtual machines on this node
salt.modules.xapi_virt.full_info() Return the node_info, vm_info and freemem
salt.modules.xapi_virt.get_disks(vm_) Return the disks of a named vm
salt '*' virt.get_disks <vm name>
salt.modules.xapi_virt.get_macs(vm_) Return a list off MAC addresses from the named vm
salt '*' virt.get_macs <vm name>
salt.modules.xapi_virt.get_nics(vm_) Return info about the network interfaces of a named vm
salt '*' virt.get_nics <vm name>
salt.modules.xapi_virt.is_hyper() Returns a bool whether or not this node is a hypervisor of any kind
salt.modules.xapi_virt.list_domains() Return a list of virtual machine names on the minion
salt.modules.xapi_virt.migrate(vm_, target, live=1, port=0, node=- 1, ssl=None, change_home_server=0) Migrates the virtual machine to another hypervisor
salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server]
Optional values:
live   Use live migration
port   Use a specified port
node   Use specified NUMA node on target
ssl    use ssl connection for migration
change_home_server change home server for managed domains
salt.modules.xapi_virt.node_info() Return a dict with information about this node
salt.modules.xapi_virt.pause(vm_) Pause the named vm
salt '*' virt.pause <vm name>
salt.modules.xapi_virt.reboot(vm_) Reboot a domain via ACPI request
salt '*' virt.reboot <vm name>
salt.modules.xapi_virt.reset(vm_) Reset a VM by emulating the reset button on a physical machine
salt '*' virt.reset <vm name>
salt.modules.xapi_virt.resume(vm_) Resume the named vm
salt '*' virt.resume <vm name>
salt.modules.xapi_virt.setmem(vm_, memory) Changes the amount of memory allocated to VM.
Memory is to be specified in MB
salt '*' virt.setmem myvm 768
salt.modules.xapi_virt.setvcpus(vm_, vcpus) Changes the amount of vcpus allocated to VM.
vcpus is an int representing the number to be assigned
salt '*' virt.setvcpus myvm 2
salt.modules.xapi_virt.shutdown(vm_) Send a soft shutdown signal to the named vm
salt '*' virt.shutdown <vm name>
salt.modules.xapi_virt.start(config_) Start a defined domain
salt '*' virt.start <path to Xen cfg file>
salt.modules.xapi_virt.stop(vm_) Hard power down the virtual machine, this is equivalent to pulling the power
salt '*' virt.stop <vm name>
salt.modules.xapi_virt.vcpu_pin(vm_, vcpu, cpus) Set which CPUs a VCPU can use.
salt 'foo' virt.vcpu_pin domU-id 2 1 salt 'foo' virt.vcpu_pin domU-id 2 2-6
salt.modules.xapi_virt.vm_cputime(vm_=None) Return cputime used by the vms on this hyper in a list of dicts:
salt.modules.xapi_virt.vm_diskstats(vm_=None) Return disk usage counters used by the vms on this hyper in a list of dicts:
[ 'your-vm': { 'io_read_kbs'   : 0, 'io_write_kbs'  : 0 }, ... ]
salt '*' virt.vm_diskstats
salt.modules.xapi_virt.vm_info(vm_=None) Return detailed information about the vms.
salt.modules.xapi_virt.vm_netstats(vm_=None) Return combined network counters used by the vms on this hyper in a list of dicts:
[ 'your-vm': { 'io_read_kbs'           : 0, 'io_total_read_kbs'     : 0, 'io_total_write_kbs'    : 0, 'io_write_kbs'          : 0 }, ... ]
salt.modules.xapi_virt.vm_state(vm_=None) Return list of all the vms and their state.
salt '*' virt.vm_state <vm name>
salt.modules.xbpspkg Package support for XBPS package manager (used by VoidLinux)
salt.modules.xbpspkg.add_repo(repo, conffile='/usr/share/xbps.d/15-saltstack.conf') Add an XBPS repository to the system.
repo   url of repo to add (persistent).
conffile path to xbps conf file to add this repo default: /usr/share/xbps.d/15-saltstack.conf
salt '*' pkg.add_repo <repo url> [conffile=/path/to/xbps/repo.conf]
salt.modules.xbpspkg.available_version(*names, **kwargs) Return the latest version of the named package available for upgrade or installation. If more than one package name is specified, a dict of name/version pairs is returned.
salt.modules.xbpspkg.del_repo(repo, **kwargs) Remove an XBPS repository from the system.
repo   url of repo to remove (persistent).
salt '*' pkg.del_repo <repo url>
salt.modules.xbpspkg.get_repo(repo, **kwargs) Display information about the repo.
salt '*' pkg.get_repo 'repo-url'
salt.modules.xbpspkg.install(name=None, refresh=False, fromrepo=None, pkgs=None, sources=None, **kwargs) Install the passed package
fromrepo Specify a package repository (url) to install from.
salt.modules.xbpspkg.latest_version(*names, **kwargs) Return the latest version of the named package available for upgrade or installation. If more than one package name is specified, a dict of name/version pairs is returned.
salt.modules.xbpspkg.list_pkgs(versions_as_list=False, **kwargs) List the packages currently installed as a dict:
salt.modules.xbpspkg.list_repos(**kwargs) List all repos known by XBPS
salt.modules.xbpspkg.list_upgrades(refresh=True, **kwargs) Check whether or not an upgrade is available for all packages
salt.modules.xbpspkg.refresh_db(**kwargs) Update list of available packages from installed repos
salt.modules.xbpspkg.remove(name=None, pkgs=None, recursive=True, **kwargs)
recursive Also remove dependent packages (not required elsewhere). Default mode: enabled.
salt '*' pkg.remove <package name> [recursive=False] salt '*' pkg.remove <package1>,<package2>,<package3> [recursive=False] salt '*' pkg.remove pkgs='["foo", "bar"]' [recursive=False]
salt.modules.xbpspkg.upgrade(refresh=True, **kwargs) Run a full system upgrade
refresh Whether or not to refresh the package database before installing.  Default is True.
salt.modules.xbpspkg.upgrade_available(name, **kwargs) Check whether or not an upgrade is available for a given package
salt.modules.xbpspkg.version(*names, **kwargs) Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.
salt.modules.xfs Module for managing XFS file systems.
salt.modules.xfs.defragment(device) Defragment mounted XFS filesystem.  In order to mount a filesystem, device should be properly mounted and writable.
salt '*' xfs.defragment /dev/sda1
salt.modules.xfs.devices() Get known XFS formatted devices on the system.
salt '*' xfs.devices
salt.modules.xfs.dump(device, destination, level=0, label=None, noerase=None) Dump filesystem device to the media (file, tape etc).
• device: XFS device, content of which to be dumped.
• destination: Specifies a dump destination.
• label: Label of the dump. Otherwise automatically generated label is used.
• level: Specifies a dump level of 0 to 9.
• noerase: Pre-erase media.
Other options are not used in order to let xfsdump use its default values, as they are most optimal. See the xfsdump(8) manpage for a more complete description of these options.
salt '*' xfs.dump /dev/sda1 /detination/on/the/client salt '*' xfs.dump /dev/sda1 /detination/on/the/client label='Company accountancy' salt '*' xfs.dump /dev/sda1 /detination/on/the/client noerase=True
salt.modules.xfs.estimate(path) Estimate the space that an XFS filesystem will take.  For each directory estimate the space that directory would take if it were copied to an XFS filesystem.  Estimation does not cross mount points.
salt '*' xfs.estimate /path/to/file salt '*' xfs.estimate /path/to/dir/*
salt.modules.xfs.info(device) Get filesystem geometry information.
salt '*' xfs.info /dev/sda1
salt.modules.xfs.inventory() Display XFS dump inventory without restoration.
salt '*' xfs.inventory
salt.modules.xfs.mkfs(device, label=None, ssize=None, noforce=None, bso=None, gmo=None, ino=None, lso=None, rso=None, nmo=None, dso=None) Create a file system on the specified device. By default wipes out with force.
• label: Specify volume label.
• ssize: Specify the fundamental sector size of the filesystem.
• noforce: Do not force create filesystem, if disk is already formatted.
Filesystem geometry options:
• bso: Block size options.
• gmo: Global metadata options.
dso: Data section options. These options specify the location, size, and other parameters of the data section of the filesystem.
• ino: Inode options to specify the inode size of the filesystem, and other inode allocation parameters.
• lso: Log section options.
• nmo: Naming options.
• rso: Realtime section options.
See the mkfs.xfs(8) manpage for a more complete description of corresponding options description.
salt '*' xfs.mkfs /dev/sda1 salt '*' xfs.mkfs /dev/sda1 dso='su=32k,sw=6' noforce=True salt '*' xfs.mkfs /dev/sda1 dso='su=32k,sw=6' lso='logdev=/dev/sda2,size=10000b'
salt.modules.xfs.modify(device, label=None, lazy_counting=None, uuid=None) Modify parameters of an XFS filesystem.
salt '*' xfs.modify /dev/sda1 label='My backup' lazy_counting=False salt '*' xfs.modify /dev/sda1 uuid=False salt '*' xfs.modify /dev/sda1 uuid=True
salt.modules.xfs.prune_dump(sessionid) Prunes the dump session identified by the given session id.
salt '*' xfs.prune_dump b74a3586-e52e-4a4a-8775-c3334fa8ea2c
salt.modules.xml XML file manager
salt.modules.xml.get_attribute(file, element) Return the attributes of the matched xpath element.
salt '*' xml.get_attribute /tmp/test.xml ".//element[@id='3']"
salt.modules.xml.get_value(file, element) Returns the value of the matched xpath element
salt '*' xml.get_value /tmp/test.xml ".//element"
salt.modules.xml.set_attribute(file, element, key, value) Set the requested attribute key and value for matched xpath element.
salt '*' xml.set_attribute /tmp/test.xml ".//element[@id='3']" editedby "gal"
salt.modules.xml.set_value(file, element, value) Sets the value of the matched xpath element
salt '*' xml.set_value /tmp/test.xml ".//element" "new value"
salt.modules.xmpp Module for Sending Messages via XMPP (a.k.a. Jabber)
• sleekxmpp>=1.3.1
• pyasn1
• pyasn1-modules
• dnspython
my-xmpp-login: xmpp.jid: myuser@jabber.example.org/resourcename xmpp.password: verybadpass
my-xmpp-login: xmpp.jid: myuser@jabber.example.org/salt xmpp.password: verybadpass
my-xmpp-login: xmpp.jid: myuser@jabber.example.org xmpp.password: verybadpass
class salt.modules.xmpp.SendMsgBot(jid, password, recipient, msg)
classmethod create_multi(jid, password, msg, recipients=None, rooms=None, nick='SaltStack Bot') Alternate constructor that accept multiple recipients and rooms
class salt.modules.xmpp.SleekXMPPMUC(name='')
filter(record) Determine if the specified record is to be logged.
Returns True if the record should be logged, or False otherwise.  If deemed appropriate, the record may be modified in-place.
salt.modules.xmpp.send_msg(recipient, message, jid=None, password=None, profile=None) Send a message to an XMPP recipient. Designed for use in states.
xmpp.send_msg 'admins@xmpp.example.com' 'This is a salt module test'             profile='my-xmpp-account' xmpp.send_msg 'admins@xmpp.example.com' 'This is a salt module test'             jid='myuser@xmpp.example.com/salt' password='verybadpass'
salt.modules.xmpp.send_msg_multi(message, recipients=None, rooms=None, jid=None, password=None, nick='SaltStack Bot', profile=None) Send a message to an XMPP recipient, support send message to multiple recipients or chat room.
xmpp.send_msg recipients=['admins@xmpp.example.com']             rooms=['secret@conference.xmpp.example.com']             'This is a salt module test'             profile='my-xmpp-account' xmpp.send_msg recipients=['admins@xmpp.example.com']             rooms=['secret@conference.xmpp.example.com']            'This is a salt module test'             jid='myuser@xmpp.example.com/salt' password='verybadpass'
salt.modules.yumpkg Support for YUM/DNF
NOTE: DNF is fully supported as of version 2015.5.10 and 2015.8.4 (partial support for DNF was initially added in 2015.8.0), and DNF is used automatically in place of YUM in Fedora 22 and newer.
New in version 3003: Support for tdnf on Photon OS.
class salt.modules.yumpkg.AvailablePackages(*args, **kwargs)
salt.modules.yumpkg.available_version(*names, **kwargs) This function is an alias of latest_version. Return the latest version of the named package available for upgrade or installation. If more than one package name is specified, a dict of name/version pairs is returned.
A specific repo can be requested using the fromrepo keyword argument, and the disableexcludes option is also supported.
New in version 2014.7.0: Support for the disableexcludes option
salt '*' pkg.latest_version <package name> salt '*' pkg.latest_version <package name> fromrepo=epel-testing salt '*' pkg.latest_version <package name> disableexcludes=main salt '*' pkg.latest_version <package1> <package2> <package3> ...
salt.modules.yumpkg.clean_metadata(**kwargs) New in version 2014.1.0.
Cleans local yum metadata. Functionally identical to refresh_db().
salt '*' pkg.clean_metadata
salt.modules.yumpkg.del_repo(repo, basedir=None, **kwargs) Delete a repo from <basedir> (default basedir: all dirs in reposdir yum option).
If the .repo file in which the repo exists does not contain any other repo configuration, the file itself will be deleted.
salt '*' pkg.del_repo myrepo salt '*' pkg.del_repo myrepo basedir=/path/to/dir salt '*' pkg.del_repo myrepo basedir=/path/to/dir,/path/to/another/dir
salt.modules.yumpkg.diff(*paths, **kwargs) Return a formatted diff between current files and original in a package.  NOTE: this function includes all files (configuration and not), but does not work on binary content.
Parameters path -- Full path to the installed file
Returns Difference string or raises and exception if examined file is binary.
salt '*' pkg.diff /etc/apache2/httpd.conf /etc/sudoers
salt.modules.yumpkg.download(*packages, **kwargs) New in version 2015.5.0.
Download packages to the local disk. Requires yumdownloader from yum-utils package.
NOTE: yum-utils will already be installed on the minion if the package was installed from the Fedora / EPEL repositories.
salt '*' pkg.download httpd salt '*' pkg.download httpd postfix
salt.modules.yumpkg.file_dict(*packages, **kwargs) New in version 2014.1.0.
List the files that belong to a package, grouped by package. Not specifying any packages will return a list of every file on the system's rpm database (not generally recommended).
salt.modules.yumpkg.file_list(*packages, **kwargs) New in version 2014.1.0.
List the files that belong to a package. Not specifying any packages will return a list of every file on the system's rpm database (not generally recommended).
salt.modules.yumpkg.get_locked_packages(pattern='[\\w+]+(?:[.-][^-]+)*', full=True) This function is an alias of list_holds. Changed in version 2016.3.0,2015.8.4,2015.5.10: Function renamed from pkg.get_locked_pkgs to pkg.list_holds.
List information on locked packages
NOTE: Requires the appropriate versionlock plugin package to be installed:
• On RHEL 5: yum-versionlock
• On RHEL 6 & 7: yum-plugin-versionlock
• On Fedora: python-dnf-plugins-extras-versionlock
pattern w+(?:[.-][^-]+)* Regular expression used to match the package name
full   True Show the full hold definition including version and epoch. Set to False to return just the name of the package(s) being held.
salt '*' pkg.list_holds salt '*' pkg.list_holds full=False
salt.modules.yumpkg.get_repo(repo, basedir=None, **kwargs) Display a repo from <basedir> (default basedir: all dirs in reposdir yum option).
salt '*' pkg.get_repo myrepo salt '*' pkg.get_repo myrepo basedir=/path/to/dir salt '*' pkg.get_repo myrepo basedir=/path/to/dir,/path/to/another/dir
salt.modules.yumpkg.group_diff(name) New in version 2014.1.0.
Changed in version 2016.3.0,2015.8.4,2015.5.10: Environment groups are now supported. The key names have been renamed, similar to the changes made in pkg.group_info.
salt '*' pkg.group_diff 'Perl Support'
salt.modules.yumpkg.group_info(name, expand=False, ignore_groups=None) New in version 2014.1.0.
Changed in version 3001,2016.3.0,2015.8.4,2015.5.10: The return data has changed. A new key type has been added to distinguish environment groups from package groups. Also, keys for the group name and group ID have been added. The mandatory packages, optional packages, and default packages keys have been renamed to mandatory, optional, and default for accuracy, as environment groups include other groups, and not packages. Finally, this function now properly identifies conditional packages.
Lists packages belonging to a certain group
name   Name of the group to query
expand False If the specified group is an environment group, then the group will be expanded and the return data will include package names instead of group names.
ignore_groups None This parameter can be used to pass a list of groups to ignore when expanding subgroups. It is used during recursion in order to prevent expanding the same group multiple times.
salt '*' pkg.group_info 'Perl Support'
salt.modules.yumpkg.group_install(name, skip=(), include=(), **kwargs) New in version 2014.1.0.
Install the passed package group(s). This is basically a wrapper around pkg.install, which performs package group resolution for the user. This function is currently considered experimental, and should be expected to undergo changes.
name   Package group to install. To install more than one group, either use a comma-separated list or pass the value as a python list.
salt '*' pkg.group_install 'Group 1' salt '*' pkg.group_install 'Group 1,Group 2' salt '*' pkg.group_install '["Group 1", "Group 2"]'
skip   Packages that would normally be installed by the package group ("default" packages), which should not be installed. Can be passed either as a comma-separated list or a python list.
salt '*' pkg.group_install 'My Group' skip='foo,bar' salt '*' pkg.group_install 'My Group' skip='["foo", "bar"]'
include Packages which are included in a group, which would not normally be installed by a yum groupinstall ("optional" packages). Note that this will not enforce group membership; if you include packages which are not members of the specified groups, they will still be installed.  Can be passed either as a comma-separated list or a python list.
salt '*' pkg.group_install 'My Group' include='foo,bar' salt '*' pkg.group_install 'My Group' include='["foo", "bar"]'
NOTE: Because this is essentially a wrapper around pkg.install, any argument which can be passed to pkg.install may also be included here, and it will be passed along wholesale.
salt.modules.yumpkg.group_list() New in version 2014.1.0.
Lists all groups known by yum on this system
salt.modules.yumpkg.groupinstall(name, skip=(), include=(), **kwargs) This function is an alias of group_install. New in version 2014.1.0.
salt.modules.yumpkg.hold(name=None, pkgs=None, sources=None, normalize=True, **kwargs) New in version 2014.7.0.
Version-lock packages
salt.modules.yumpkg.info_installed(*names, **kwargs) New in version 2015.8.1.
Return the information of the named package(s), installed on the system.
Parameters all_versions -- Include information for all versions of the packages installed on the minion.
salt '*' pkg.info_installed <package1> salt '*' pkg.info_installed <package1> <package2> <package3> ... salt '*' pkg.info_installed <package1> <package2> <package3> all_versions=True
salt.modules.yumpkg.install(name=None, refresh=False, skip_verify=False, pkgs=None, sources=None, downloadonly=False, reinstall=False, normalize=True, update_holds=False, saltenv='base', ignore_epoch=False, **kwargs) Changed in version 2015.8.12,2016.3.3,2016.11.0: On minions running systemd>=205, systemd-run(1) is now used to isolate commands which modify installed packages from the salt-minion daemon's control group. This is done to keep systemd from killing any yum/dnf commands spawned by Salt when the salt-minion service is restarted. (see KillMode in the systemd.kill(5) manpage for more information). If desired, usage of systemd-run(1) can be suppressed by setting a config option called systemd.scope, with a value of False (no quotes).
Install the passed package(s), add refresh=True to clean the yum database before package is installed.
32-bit packages can be installed on 64-bit systems by appending the architecture designation (.i686, .i586, etc.) to the end of the package name.
reinstall Specifying reinstall=True will use yum reinstall rather than yum install for requested packages that are already installed.
If a version is specified with the requested package, then yum reinstall will only be used if the installed version matches the requested version.
Works with sources when the package header of the source can be matched to the name and version of an installed package.
skip_verify Skip the GPG verification check (e.g., --nogpgcheck)
downloadonly Only download the packages, do not install.
version Install a specific version of the package, e.g. 1.2.3-4.el5. Ignored if "pkgs" or "sources" is passed.
update_holds False If True, and this function would update the package version, any packages held using the yum/dnf "versionlock" plugin will be unheld so that they can be updated. Otherwise, if this function attempts to update a held package, the held package(s) will be skipped and an error will be raised.
setopt A comma-separated or Python list of key=value options. This list will be expanded and --setopt prepended to each in the yum/dnf command that is run.
salt '*' pkg.install foo setopt='obsoletes=0,plugins=0'
Repository Options:
fromrepo Specify a package repository (or repositories) from which to install.  (e.g., yum --disablerepo='*' --enablerepo='somerepo')
enablerepo (ignored if fromrepo is specified) Specify a disabled package repository (or repositories) to enable.  (e.g., yum --enablerepo='somerepo')
disablerepo (ignored if fromrepo is specified) Specify an enabled package repository (or repositories) to disable.  (e.g., yum --disablerepo='somerepo')
disableexcludes Disable exclude from main, for a repo or for everything. (e.g., yum --disableexcludes='main')
pkgs   A list of packages to install from a software repository. Must be passed as a python list. A specific version number can be specified by using a single-element dict representing the package and its version.
salt '*' pkg.install pkgs='["foo", "bar"]' salt '*' pkg.install pkgs='["foo", {"bar": "1.2.3-4.el5"}]'
sources A list of RPM packages to install. Must be passed as a list of dicts, with the keys being package names, and the values being the source URI or local path to the package.
salt '*' pkg.install sources='[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'
normalize True Normalize the package name by removing the architecture. This is useful for poorly created packages which might include the architecture as an actual part of the name such as kernel modules which match a specific kernel version.
salt -G role:nsd pkg.install gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False
diff_attr: If a list of package attributes is specified, returned value will contain them, eg.:
{'<package>': { 'old': { 'version': '<old-version>', 'arch': '<old-arch>'},
'new': { 'version': '<new-version>', 'arch': '<new-arch>'}}}
Valid attributes are: epoch, version, release, arch, install_date, install_date_time_t.
If all is specified, all valid attributes will be returned.
If an attribute list in diff_attr is specified, the dict will also contain any specified attribute, eg.:
salt.modules.yumpkg.latest_version(*names, **kwargs) Return the latest version of the named package available for upgrade or installation. If more than one package name is specified, a dict of name/version pairs is returned.
salt.modules.yumpkg.list_downloaded(**kwargs) New in version 2017.7.0.
List prefetched packages downloaded by Yum in the local disk.
salt.modules.yumpkg.list_holds(pattern='[\\w+]+(?:[.-][^-]+)*', full=True) Changed in version 2016.3.0,2015.8.4,2015.5.10: Function renamed from pkg.get_locked_pkgs to pkg.list_holds.
salt.modules.yumpkg.list_installed_patches(**kwargs) New in version 2017.7.0.
List installed advisory patches on the system.
salt '*' pkg.list_installed_patches
salt.modules.yumpkg.list_patches(refresh=False, **kwargs) New in version 2017.7.0.
List all known advisory patches from available repos.
refresh force a refresh if set to True.  If set to False (default) it depends on yum if a refresh is executed.
salt '*' pkg.list_patches
salt.modules.yumpkg.list_pkgs(versions_as_list=False, **kwargs) List the packages currently installed as a dict. By default, the dict contains versions as a comma separated string:
{'<package_name>': '<version>[,<version>...]'}
versions_as_list: If set to true, the versions are provided as a list
{'<package_name>': ['<version>', '<version>']}
attr:  If a list of package attributes is specified, returned value will contain them in addition to version, eg.:
{'<package_name>': [{'version' : 'version', 'arch' : 'arch'}]}
If all is specified, all valid attributes will be returned. New in version 2018.3.0.
salt '*' pkg.list_pkgs salt '*' pkg.list_pkgs attr=version,arch salt '*' pkg.list_pkgs attr='["version", "arch"]'
salt.modules.yumpkg.list_repo_pkgs(*args, **kwargs) New in version 2014.1.0.
Changed in version 2014.7.0: All available versions of each package are now returned. This required a slight modification to the structure of the return dict. The return data shown below reflects the updated return dict structure. Note that packages which are version-locked using pkg.hold will only show the currently-installed version, as locking a package will make other versions appear unavailable to yum/dnf.
Changed in version 2017.7.0: By default, the versions for each package are no longer organized by repository. To get results organized by repository, use byrepo=True.
Returns all available packages. Optionally, package names (and name globs) can be passed and the results will be filtered to packages matching those names. This is recommended as it speeds up the function considerably.
WARNING: Running this function on RHEL/CentOS 6 and earlier will be more resource-intensive, as the version of yum that ships with older RHEL/CentOS has no yum subcommand for listing packages from a repository. Thus, a yum list installed and yum list available are run, which generates a lot of output, which must then be analyzed to determine which package information to include in the return data.
# With byrepo=False (default) { 'bash': ['4.1.2-15.el6_5.2', '4.1.2-15.el6_5.1', '4.1.2-15.el6_4'], 'kernel': ['2.6.32-431.29.2.el6', '2.6.32-431.23.3.el6', '2.6.32-431.20.5.el6', '2.6.32-431.20.3.el6', '2.6.32-431.17.1.el6', '2.6.32-431.11.2.el6', '2.6.32-431.5.1.el6', '2.6.32-431.3.1.el6', '2.6.32-431.1.2.0.1.el6', '2.6.32-431.el6'] } # With byrepo=True { 'base': { 'bash': ['4.1.2-15.el6_4'], 'kernel': ['2.6.32-431.el6'] }, 'updates': { 'bash': ['4.1.2-15.el6_5.2', '4.1.2-15.el6_5.1'], 'kernel': ['2.6.32-431.29.2.el6', '2.6.32-431.23.3.el6', '2.6.32-431.20.5.el6', '2.6.32-431.20.3.el6', '2.6.32-431.17.1.el6', '2.6.32-431.11.2.el6', '2.6.32-431.5.1.el6', '2.6.32-431.3.1.el6', '2.6.32-431.1.2.0.1.el6'] } }
cacheonly False When True, the repo information will be retrieved from the cached repo metadata. This is equivalent to passing the -C option to yum/dnf.
salt.modules.yumpkg.list_repos(basedir=None, **kwargs) Lists all repos in <basedir> (default: all dirs in reposdir yum option).
salt '*' pkg.list_repos salt '*' pkg.list_repos basedir=/path/to/dir salt '*' pkg.list_repos basedir=/path/to/dir,/path/to/another/dir
salt.modules.yumpkg.list_updates(refresh=True, **kwargs) This function is an alias of list_upgrades. Check whether or not an upgrade is available for all packages
The fromrepo, enablerepo, and disablerepo arguments are supported, as used in pkg states, and the disableexcludes option is also supported.
salt.modules.yumpkg.list_upgrades(refresh=True, **kwargs) Check whether or not an upgrade is available for all packages
salt.modules.yumpkg.mod_repo(repo, basedir=None, **kwargs) Modify one or more values for a repo. If the repo does not exist, it will be created, so long as the following values are specified:
repo   name by which the yum refers to the repo
name   a human-readable name for the repo
baseurl the URL for yum to reference
mirrorlist the URL for yum to reference
Key/Value pairs may also be removed from a repo's configuration by setting a key to a blank value. Bear in mind that a name cannot be deleted, and a baseurl can only be deleted if a mirrorlist is specified (or vice versa).
salt '*' pkg.mod_repo reponame enabled=1 gpgcheck=1 salt '*' pkg.mod_repo reponame basedir=/path/to/dir enabled=1 salt '*' pkg.mod_repo reponame baseurl= mirrorlist=http://host.com/
salt.modules.yumpkg.modified(*packages, **flags) List the modified files that belong to a package. Not specifying any packages will return a list of _all_ modified files on the system's RPM database.
Filtering by flags (True or False):
size   Include only files where size changed.
mode   Include only files which file's mode has been changed.
checksum Include only files which MD5 checksum has been changed.
device Include only files which major and minor numbers has been changed.
symlink Include only files which are symbolic link contents.
owner  Include only files where owner has been changed.
group  Include only files where group has been changed.
time   Include only files where modification time of the file has been changed.
capabilities Include only files where capabilities differ or not. Note: supported only on newer RPM versions.
salt '*' pkg.modified salt '*' pkg.modified httpd salt '*' pkg.modified httpd postfix salt '*' pkg.modified httpd owner=True group=False
salt.modules.yumpkg.normalize_name(name) Strips the architecture from the specified package name, if necessary.  Circumstances where this would be done include:
• If the arch is 32 bit and the package name ends in a 32-bit arch.
• If the arch matches the OS arch, or is noarch.
salt '*' pkg.normalize_name zsh.x86_64
salt.modules.yumpkg.owner(*paths, **kwargs) New in version 2014.7.0.
salt '*' pkg.owner /usr/bin/apachectl salt '*' pkg.owner /usr/bin/apachectl /etc/httpd/conf/httpd.conf
salt.modules.yumpkg.parse_arch(name) Parse name and architecture from the specified package name.
salt '*' pkg.parse_arch zsh.x86_64
salt.modules.yumpkg.purge(name=None, pkgs=None, **kwargs) Changed in version 2015.8.12,2016.3.3,2016.11.0: On minions running systemd>=205, systemd-run(1) is now used to isolate commands which modify installed packages from the salt-minion daemon's control group. This is done to keep systemd from killing any yum/dnf commands spawned by Salt when the salt-minion service is restarted. (see KillMode in the systemd.kill(5) manpage for more information). If desired, usage of systemd-run(1) can be suppressed by setting a config option called systemd.scope, with a value of False (no quotes).
Package purges are not supported by yum, this function is identical to pkg.remove.
name   The name of the package to be purged
salt.modules.yumpkg.refresh_db(**kwargs) Check the yum repos for updated packages
• True: Updates are available
• False: An error occurred
• None: No updates are available
repo   Refresh just the specified repo
disablerepo Do not refresh the specified repo
enablerepo Refresh a disabled repo using this option
branch Add the specified branch when refreshing
disableexcludes Disable the excludes defined in your config files. Takes one of three options: - all - disable all excludes - main - disable excludes defined in [main] in yum.conf - repoid - disable excludes defined for that repo
salt.modules.yumpkg.remove(name=None, pkgs=None, **kwargs) Changed in version 2015.8.12,2016.3.3,2016.11.0: On minions running systemd>=205, systemd-run(1) is now used to isolate commands which modify installed packages from the salt-minion daemon's control group. This is done to keep systemd from killing any yum/dnf commands spawned by Salt when the salt-minion service is restarted. (see KillMode in the systemd.kill(5) manpage for more information). If desired, usage of systemd-run(1) can be suppressed by setting a config option called systemd.scope, with a value of False (no quotes).
name   The name of the package to be removed
salt.modules.yumpkg.services_need_restart(**kwargs) New in version 3003.
Requires systemd.
salt.modules.yumpkg.unhold(name=None, pkgs=None, sources=None, **kwargs) New in version 2014.7.0.
Remove version locks
salt.modules.yumpkg.update(name=None, pkgs=None, refresh=True, skip_verify=False, normalize=True, minimal=False, obsoletes=False, **kwargs) New in version 2019.2.0.
Calls pkg.upgrade with obsoletes=False. Mirrors the CLI behavior of yum update.  See pkg.upgrade for further documentation.
salt '*' pkg.update
salt.modules.yumpkg.upgrade(name=None, pkgs=None, refresh=True, skip_verify=False, normalize=True, minimal=False, obsoletes=True, **kwargs) Run a full system upgrade (a yum upgrade or dnf upgrade), or upgrade specified packages. If the packages aren't installed, they will not be installed.
Changed in version 2015.8.12,2016.3.3,2016.11.0: On minions running systemd>=205, systemd-run(1) is now used to isolate commands which modify installed packages from the salt-minion daemon's control group. This is done to keep systemd from killing any yum/dnf commands spawned by Salt when the salt-minion service is restarted. (see KillMode in the systemd.kill(5) manpage for more information). If desired, usage of systemd-run(1) can be suppressed by setting a config option called systemd.scope, with a value of False (no quotes).
Changed in version 2019.2.0: Added obsoletes and minimal arguments
salt '*' pkg.upgrade salt '*' pkg.upgrade name=openssl
New in version 2014.7.
name   The name of the package to be upgraded. Note that this parameter is ignored if "pkgs" is passed.
32-bit packages can be upgraded on 64-bit systems by appending the architecture designation (.i686, .i586, etc.) to the end of the package name.
Warning: if you forget 'name=' and run pkg.upgrade openssl, ALL packages are upgraded. This will be addressed in next releases.
salt '*' pkg.upgrade name=openssl
pkgs   A list of packages to upgrade from a software repository. Must be passed as a python list. A specific version number can be specified by using a single-element dict representing the package and its version. If the package was not already installed on the system, it will not be installed.
salt '*' pkg.upgrade pkgs='["foo", "bar"]' salt '*' pkg.upgrade pkgs='["foo", {"bar": "1.2.3-4.el5"}]'
salt -G role:nsd pkg.upgrade gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False
minimal False Use upgrade-minimal instead of upgrade (e.g., yum upgrade-minimal) Goes to the 'newest' package match which fixes a problem that affects your system.
salt '*' pkg.upgrade minimal=True
obsoletes True Controls whether yum/dnf should take obsoletes into account and remove them.  If set to False yum will use update instead of upgrade and dnf will be run with --obsoletes=False
salt '*' pkg.upgrade obsoletes=False
NOTE: To add extra arguments to the yum upgrade command, pass them as key word arguments. For arguments without assignments, pass True
salt '*' pkg.upgrade security=True exclude='kernel*'
salt.modules.yumpkg.upgrade_available(name, **kwargs) Check whether or not an upgrade is available for a given package
salt.modules.yumpkg.verify(*names, **kwargs) New in version 2014.1.0.
Runs an rpm -Va on a system, and returns the results in a dict
Pass options to modify rpm verify behavior using the verify_options keyword argument
salt '*' pkg.verify salt '*' pkg.verify httpd salt '*' pkg.verify 'httpd postfix' salt '*' pkg.verify 'httpd postfix' ignore_types=['config','doc'] salt '*' pkg.verify 'httpd postfix' verify_options=['nodeps','nosize']