2019-08-09 23:47:49 +02:00
.. _readme:
2018-02-12 08:16:03 -03:00
packages-formula
================
2019-08-09 23:47:49 +02:00
|img_travis| |img_sr|
2020-06-01 19:15:54 +01:00
.. |img_travis| image :: https://travis-ci.com/saltstack-formulas/packages-formula.svg?branch=master
2019-08-09 23:47:49 +02:00
:alt: Travis CI Build Status
:scale: 100%
2020-06-01 19:15:54 +01:00
:target: https://travis-ci.com/saltstack-formulas/packages-formula
2019-08-09 23:47:49 +02:00
.. |img_sr| image :: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
:alt: Semantic Release
:scale: 100%
:target: https://github.com/semantic-release/semantic-release
2020-06-01 19:15:54 +01:00
A simple 'packages manager' formula, to install/remove packages without further ado.
2018-02-12 08:16:03 -03:00
2019-08-09 23:47:49 +02:00
.. contents :: **Table of Contents**
2020-06-01 19:15:54 +01:00
:depth: 1
2019-08-09 23:47:49 +02:00
General notes
-------------
See the full `SaltStack Formulas installation and usage instructions
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html> `_.
If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#writing-formulas> `_.
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 <http://semver.org/> `_ .
See `Formula Versioning Section <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#versioning> `_ for more details.
Contributing to this repo
-------------------------
**Commit message formatting is significant!!**
2020-06-01 19:15:54 +01:00
Please see `How to contribute <https://github.com/saltstack-formulas/.github/blob/master/CONTRIBUTING.rst> `_ for more details.
2019-08-09 23:47:49 +02:00
2020-06-01 19:15:54 +01:00
Special notes
-------------
2018-02-15 14:03:10 -03:00
2018-02-12 08:16:03 -03:00
What this formula can do
2020-06-01 19:15:54 +01:00
^^^^^^^^^^^^^^^^^^^^^^^^
2018-02-12 08:16:03 -03:00
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.
What this formula can't do
2020-06-01 19:15:54 +01:00
^^^^^^^^^^^^^^^^^^^^^^^^^^
2018-02-12 08:16:03 -03:00
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.
2020-06-01 19:15:54 +01:00
Available states
----------------
2018-02-12 08:16:03 -03:00
.. contents ::
2019-08-09 23:47:49 +02:00
:local:
2018-02-12 08:16:03 -03:00
`` packages ``
2019-08-09 23:47:49 +02:00
^^^^^^^^^^^^
*Meta-state (This is a state that includes other states)* .
2018-02-12 08:16:03 -03:00
Runs all the other states in the formula.
`` packages.pkgs ``
2019-08-09 23:47:49 +02:00
^^^^^^^^^^^^^^^^^
2018-02-12 08:16:03 -03:00
2018-03-02 20:33:31 -03:00
Allows you to manage system's packages. You can specify:
2018-03-06 18:27:16 -03:00
* `` 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.
2018-03-02 20:33:31 -03:00
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.pkgs `` one of the following packages:
+ CentOS
2020-06-01 19:15:54 +01:00
.. code-block :: yaml
packages:
pkgs:
required:
pkgs:
- yum-plugin-versionlock
2018-03-02 20:33:31 -03:00
+ Fedora > 26 with Python3:
2020-06-01 19:15:54 +01:00
.. code-block :: yaml
packages:
pkgs:
required:
pkgs:
- python3-dnf-plugin-versionlock
2018-03-02 20:33:31 -03:00
+ Fedora > 26 with Python2:
2020-06-01 19:15:54 +01:00
.. code-block :: yaml
packages:
pkgs:
required:
pkgs:
- python2-dnf-plugin-versionlock
2018-03-02 20:33:31 -03:00
* `` 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 the
`` held `` dict to this list.
2018-02-12 08:16:03 -03:00
* `` unwanted `` system packages, which will be uninstalled.
* `` required system packages `` on which any of the `` wanted `` packages depend
for their correct installation.
* `` required states `` on which any of the `` wanted `` packages depend for their
correct installation.
`` packages.pips ``
2019-08-09 23:47:49 +02:00
^^^^^^^^^^^^^^^^^
2018-02-12 08:16:03 -03:00
You can specify:
* `` wanted `` python packages, which will be installed using pip. Requires you
specify the correct `` python-pip `` package for your distro, as a dependency
(see the pillar.example)
* `` unwanted `` python packages, which will be uninstalled using pip.
* `` required system packages `` on which any of the `` wanted `` python packages
depend for their correct installation. Usually, a `` python-pip `` package and/or
some other compiler packages are required.
* `` required states `` on which any of the `` wanted `` packages depend for their
correct installation (ie, `` epel `` for RedHat families).
`` packages.gems ``
2019-08-09 23:47:49 +02:00
^^^^^^^^^^^^^^^^^
2018-02-12 08:16:03 -03:00
You can specify:
* `` wanted `` ruby packages, which will be installed using gem. Requires you
specify the correct `` ruby `` package for your distro, as a dependency
(see the pillar.example)
* `` unwanted `` ruby packages, which will be uninstalled using gem.
* `` required system packages `` on which any of the `` wanted `` ruby packages
depend for their correct installation. Usually, a `` ruby `` package and/or
some other compiler packages are required.
* `` required states `` on which any of the `` wanted `` packages depend for their
correct installation (ie, `` epel `` for RedHat families).
2019-03-10 09:18:39 -03:00
`` packages.npms ``
2019-08-09 23:47:49 +02:00
^^^^^^^^^^^^^^^^^
2019-03-10 09:18:39 -03:00
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 <https://github.com/saltstack-formulas/node-formula> `_
and add a dependency for it in the pillar `npms:required:sls` (see the pillar.example)
You can specify:
* `` wanted `` npm packages, which will be installed using npm. Requires you
specify the correct `` npm `` package for your distro, as a dependency
(see the pillar.example)
* `` unwanted `` npm packages, which will be uninstalled using npm.
* `` required system packages `` on which any of the `` wanted `` npm packages
depend for their correct installation. Usually, a `` npm `` package and/or
some other compiler packages are required.
* `` required states `` on which any of the `` wanted `` packages depend for their
correct installation (ie, `` epel `` for RedHat families).
2018-08-22 00:55:53 +01:00
`` packages.archives ``
2020-06-01 19:15:54 +01:00
^^^^^^^^^^^^^^^^^^^^^
2018-08-22 00:55:53 +01:00
2018-09-18 10:27:07 +01:00
'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.
2018-08-22 00:55:53 +01:00
* `` wanted `` archive package software, which will be installed by extraction.
* `` unwanted `` archive package software, which are uninstalled by directory removal.
* `` required archive packages `` on which any of the `` wanted `` items depend on. Optional.
2018-03-13 14:36:11 +00:00
`` packages.snaps ``
2019-08-09 23:47:49 +02:00
^^^^^^^^^^^^^^^^^^
2018-03-13 14:36:11 +00:00
You can specify:
* `` wanted `` snapd packages, which will be installed using snap.
2018-04-09 14:18:40 -04:00
* `` classic `` snapd packages, chich will be installed using snap with classic confinement.
2018-03-13 14:36:11 +00:00
* `` unwanted `` snapd packages, which will be uninstalled using snap.
* `` required system packages `` on which any of the `` wanted `` snapd packages
depend for their correct installation.
* `` required states `` on which any of the `` wanted `` packages depend for their
correct installation (ie, `` epel `` for RedHat families).
2018-03-20 16:42:42 +00:00
.. note ::
2020-06-01 19:15:54 +01:00
Centos has no native `` snapd `` package at this time.
2018-03-20 16:42:42 +00:00
2019-08-18 15:47:11 +01:00
`` packages.golang ``
2020-06-01 19:15:54 +01:00
^^^^^^^^^^^^^^^^^^^
2019-08-18 15:47:11 +01:00
You can specify:
* `` clean `` golang packages, removed using `` go clean -i <item>... `` .
* `` goget `` golang packages, installed using `` go get `` .
2018-02-12 08:16:03 -03:00
`` packages.remote_pkgs ``
2019-08-09 23:47:49 +02:00
^^^^^^^^^^^^^^^^^^^^^^^^
2018-02-12 08:16:03 -03:00
You can specify a dictionary of remote system packages (deb/rpm) that you want
to install, in the format:
`` name: url ``
2019-09-14 21:23:59 +02:00
2020-06-01 19:15:54 +01:00
`` packages.chocolatey ``
^^^^^^^^^^^^^^^^^^^^^^^
2019-09-14 21:23:59 +02:00
You can specify:
* `` wanted `` chocolatey packages, which will be installed using chocolatey. Requires you
specify the correct `` chocolatey `` package (see the pillar.example)
* `` unwanted `` chocolatey packages, which will be uninstalled using chocolatey.
* `` required system packages `` on which any of the `` wanted `` system packages
depend for their correct installation.
* `` required states `` on which any of the `` wanted `` packages depend for their
correct installation (ie, `` regedit `` for configurations).
.. note ::
2020-06-01 19:15:54 +01:00
You must configure `winrepo-ng <https://github.com/saltstack/salt-winrepo-ng> `_ in order to install chocolatey required package
2019-09-14 21:23:59 +02:00
2018-02-12 08:16:03 -03:00
Testing
2019-08-09 23:47:49 +02:00
-------
Linux testing is done with `` kitchen-salt `` .
Requirements
^^^^^^^^^^^^
* Ruby
* Docker
.. code-block :: bash
$ 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 `` .
`` bin/kitchen converge ``
^^^^^^^^^^^^^^^^^^^^^^^^
2020-06-01 19:15:54 +01:00
Creates the docker instance and runs the `` packages `` main state, ready for testing.
2019-08-09 23:47:49 +02:00
`` bin/kitchen verify ``
^^^^^^^^^^^^^^^^^^^^^^
Runs the `` inspec `` tests on the actual instance.
`` bin/kitchen destroy ``
^^^^^^^^^^^^^^^^^^^^^^^
Removes the docker instance.
`` bin/kitchen test ``
^^^^^^^^^^^^^^^^^^^^
Runs all of the stages above in one go: i.e. `` destroy `` + `` converge `` + `` verify `` + `` destroy `` .
2018-02-12 08:16:03 -03:00
2019-08-09 23:47:49 +02:00
`` bin/kitchen login ``
^^^^^^^^^^^^^^^^^^^^^
2018-02-12 08:16:03 -03:00
2019-08-09 23:47:49 +02:00
Gives you SSH access to the instance for manual testing.