A simple 'packages manager' formula, to install/remove packages without further ado.
Table of Contents
See the full SaltStack Formulas installation and usage instructions.
If you are interested in writing or contributing to formulas, please pay attention to the Writing Formula Section.
If you want to use this formula, please pay attention to the FORMULA file and/or git tag,
which contains the currently released version. This formula is versioned according to Semantic Versioning.
See Formula Versioning Section for more details.
Commit message formatting is significant!!
Please see How to contribute for more details.
Many times, in the process of setting up a host/vm, you need to install/remove packages with no extra configuration or setup. This formula tries to help with that. It can get a list of packages from a pillar, and it will try to install them.
It provides a few states to install/remove system packages (currently Debian/Redhat families), Python packages (using pip states) and Ruby gems (using gem states).
It can also provide basic dependency management on certain other states/packages.
This formula is not intended to configure packages, nor setup services or daemons. When you need to do that for a package, you should probably be using another formula.
Meta-state (This is a state that includes other states).
Runs all the other states in the formula.
Allows you to manage system's packages. You can specify:
held: either a list of packages or a dict of package: version, which will be installed and pinned to the installed version using SaltStack's hold/unhold capability.When upgrading a version, the package will be temporarily unheld, upgraded and then held again.
In the RedHat family, helding packages depend on a yum plugin that you need to install. In order to do this, you can add it using this formula, adding to your
pkgs.required.pkgsone of the following packages:CentOS
packages: pkgs: required: pkgs: - yum-plugin-versionlock
Fedora > 26 with Python3:
packages: pkgs: required: pkgs: - python3-dnf-plugin-versionlock
Fedora > 26 with Python2:
packages: pkgs: required: pkgs: - python2-dnf-plugin-versionlock
wanted: a list of packages which will be installed. Packages in this list will be automatically unheld so, if you want to permanently unheld a package you were previously helding to a version, just move it from thehelddict to this list.unwantedsystem packages, which will be uninstalled.required system packageson which any of thewantedpackages depend for their correct installation.required stateson which any of thewantedpackages depend for their correct installation.
You can specify:
wantedpython packages, which will be installed using pip. Requires you specify the correctpython-pippackage for your distro, as a dependency (see the pillar.example)unwantedpython packages, which will be uninstalled using pip.required system packageson which any of thewantedpython packages depend for their correct installation. Usually, apython-pippackage and/or some other compiler packages are required.required stateson which any of thewantedpackages depend for their correct installation (ie,epelfor RedHat families).
You can specify:
wantedruby packages, which will be installed using gem. Requires you specify the correctrubypackage for your distro, as a dependency (see the pillar.example)unwantedruby packages, which will be uninstalled using gem.required system packageson which any of thewantedruby packages depend for their correct installation. Usually, arubypackage and/or some other compiler packages are required.required stateson which any of thewantedpackages depend for their correct installation (ie,epelfor RedHat families).
This formula DOES NOT install nodejs/npm, as it's outside of its scope:
nodejs/npm that comes with the distros is usually outdated, so it's required to add
a repo, run scripts, etc, and this formula manages packages :)
You can use the nodejs-formula and add a dependency for it in the pillar npms:required:sls (see the pillar.example)
You can specify:
wantednpm packages, which will be installed using npm. Requires you specify the correctnpmpackage for your distro, as a dependency (see the pillar.example)unwantednpm packages, which will be uninstalled using npm.required system packageson which any of thewantednpm packages depend for their correct installation. Usually, anpmpackage and/or some other compiler packages are required.required stateson which any of thewantedpackages depend for their correct installation (ie,epelfor RedHat families).
'Archive file` handler for common 'download' and 'checksum' states. All formats recognized by salt.states.archive.extracted (tar, rar, zip, etc) will be extracted. Alternatively raw formats are supported (raw, bin,) for standard and binary executable files.
wantedarchive package software, which will be installed by extraction.unwantedarchive package software, which are uninstalled by directory removal.required archive packageson which any of thewanteditems depend on. Optional.
You can specify:
wantedsnapd packages, which will be installed using snap.classicsnapd packages, chich will be installed using snap with classic confinement.unwantedsnapd packages, which will be uninstalled using snap.required system packageson which any of thewantedsnapd packages depend for their correct installation.required stateson which any of thewantedpackages depend for their correct installation (ie,epelfor RedHat families).
Note
Centos has no native snapd package at this time.
You can specify:
cleangolang packages, removed usinggo clean -i <item>....gogetgolang packages, installed usinggo get.
You can specify a dictionary of remote system packages (deb/rpm) that you want to install, in the format:
name: url
You can specify:
wantedchocolatey packages, which will be installed using chocolatey. Requires you specify the correctchocolateypackage (see the pillar.example)unwantedchocolatey packages, which will be uninstalled using chocolatey.required system packageson which any of thewantedsystem packages depend for their correct installation.required stateson which any of thewantedpackages depend for their correct installation (ie,regeditfor configurations).
Note
You must configure winrepo-ng in order to install chocolatey required package
Linux testing is done with kitchen-salt.
- Ruby
- Docker
$ gem install bundler
$ bundle install
$ bin/kitchen test [platform]Where [platform] is the platform name defined in kitchen.yml,
e.g. debian-9-2019-2-py3.
Creates the docker instance and runs the packages main states, ready for testing.
Runs the inspec tests on the actual instance.
Removes the docker instance.
Runs all of the stages above in one go: i.e. destroy + converge + verify + destroy.
Gives you SSH access to the instance for manual testing.
Windows/FreeBSD/OpenBSD testing is done with kitchen-salt.
- Ruby
- Virtualbox
- Vagrant
$ gem install bundler
$ bundle install --with=vagrant
$ bin/kitchen test [platform]Where [platform] is the platform name defined in kitchen.vagrant.yml,
e.g. windows-81-latest-py3.
When testing using Vagrant you must set the environment variable KITCHEN_LOCAL_YAML to kitchen.vagrant.yml. For example:
$ KITCHEN_LOCAL_YAML=kitchen.vagrant.yml bin/kitchen test # Alternatively,
$ export KITCHEN_LOCAL_YAML=kitchen.vagrant.yml
$ bin/kitchen testThen run the following commands as needed.
Creates the Vagrant instance and runs the packages main states, ready for testing.
Runs the inspec tests on the actual instance.
Removes the Vagrant instance.
Runs all of the stages above in one go: i.e. destroy + converge + verify + destroy.
Gives you RDP/SSH access to the instance for manual testing.