Merge pull request #60 from kartnico/chocolatey

Add chocolatey management support
This commit is contained in:
Imran Iqbal 2020-03-30 17:06:38 +01:00 committed by GitHub
commit 9a9d3e4d30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 148 additions and 43 deletions

View file

@ -1,43 +0,0 @@
packages formula
================
0.1.0 (2019-03-10)
- Add npm support
0.0.9 (2018-10-03)
- Add support for plain files using archive
0.0.8 (2018-08-23)
- Add archive support
0.0.7 (2018-07-11)
- Fix pip/gems for FreeBSD
0.0.6 (2018-04-09)
- Add snap with classic confinement support
0.0.5 (2018-03-14)
- Add snap support
0.0.4 (2018-03-06)
- Allow to specify held system packages also as a list (#10)
0.0.3 (2018-03-02)
- Allow to hold/unhold system packages (#8)
0.0.2 (2018-02-23)
- Add Fedora support
- Add more tests
0.0.1 (2018-02-12)
- Initial version

View file

@ -92,3 +92,56 @@ Tests
* **pillar:** use single ubuntu pillar (\ `c69cb5a <https://github.com/saltstack-formulas/packages-formula/commit/c69cb5a792186a8a1600987087389229ddf7a67a>`_\ )
* **pillar:** use specific pillar for ``debian`` (\ `adf1523 <https://github.com/saltstack-formulas/packages-formula/commit/adf1523e08bfeff8d635052a8942b48326e507cb>`_\ )
* fix existing tests (\ `8e75c9d <https://github.com/saltstack-formulas/packages-formula/commit/8e75c9d5c0c4af5fe4e56ecfcdfcc7ea7486d4dc>`_\ )
----
0.1.0 (2019-03-10)
------------------
* Add npm support
0.0.9 (2018-10-03)
------------------
* Add support for plain files using archive
0.0.8 (2018-08-23)
------------------
* Add archive support
0.0.7 (2018-07-11)
------------------
* Fix pip/gems for FreeBSD
0.0.6 (2018-04-09)
------------------
* Add snap with classic confinement support
0.0.5 (2018-03-14)
------------------
* Add snap support
0.0.4 (2018-03-06)
------------------
* Allow to specify held system packages also as a list (#10)
0.0.3 (2018-03-02)
------------------
* Allow to hold/unhold system packages (#8)
0.0.2 (2018-02-23)
------------------
* Add Fedora support
* Add more tests
0.0.1 (2018-02-12)
------------------
* Initial version

View file

@ -224,6 +224,24 @@ to install, in the format:
``name: url``
`packages.chocolatey``
^^^^^^^^^^^^^^^^^^^^^^
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::
You must configure `winrepo-ng <https://github.com/saltstack/salt-winrepo-ng>`_ in order to install chocolatey required package
Testing
-------

53
packages/chocolatey.sls Normal file
View file

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{% from "packages/map.jinja" import packages with context %}
{% if grains['os'] == 'Windows' %}
{% if packages.chocolatey %}
{% set req_states = packages.chocolatey.required.states %}
{% set req_pkgs = packages.chocolatey.required.pkgs %}
{% set wanted_chocolatey = packages.chocolatey.wanted %}
{% set unwanted_chocolatey = packages.chocolatey.unwanted %}
{% if req_states %}
include:
{% for dep in req_states %}
- {{ dep }}
{% endfor %}
{% endif %}
chocolatey_req_pkgs:
pkg.installed:
- pkgs: {{ req_pkgs | json }}
- retry: {{ packages.retry_options|json }}
### CHOCOLATEY PACKAGES to install
{% if wanted_chocolatey %}
{% for choco, settings in wanted_chocolatey.items() %}
{{ choco }}:
chocolatey.installed:
- name: {{ choco }}
- version: {{ '' if 'version' not in settings else settings.version }}
- source: {{ '' if 'source' not in settings else settings.source }}
- force: {{ False if 'force' not in settings else settings.force }}
- pre_versions: {{ False if 'pre_versions' not in settings else settings.pre_versions }}
- install_args: {{ '' if 'install_args' not in settings else settings.install_args }}
- override_args: {{ False if 'override_args' not in settings else settings.override_args }}
- force_x86: {{ False if 'force_x86' not in settings else settings.force_x86 }}
- package_args: {{ '' if 'package_args' not in settings else settings.package_args }}
- allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }}
{% endfor %}
{% endif %}
### CHOCOLATEY PACKAGES to uninstall
{% if unwanted_chocolatey %}
{% for uchoco in unwanted_chocolatey %}
{{ uchoco }}:
chocolatey.uninstalled:
- name: {{ uchoco }}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}

View file

@ -25,6 +25,12 @@ packages:
required:
states: []
pkgs: []
chocolatey:
wanted: []
unwanted: []
required:
states: []
pkgs: []
npms:
wanted: []
unwanted: []

View file

@ -10,3 +10,4 @@ include:
- packages.archives
- packages.snaps
- packages.golang
- packages.chocolatey

View file

@ -46,3 +46,9 @@ FreeBSD:
pkgs:
- lang/ruby25
- devel/ruby-gems
Windows:
chocolatey:
required:
pkgs:
- chocolatey

View file

@ -62,6 +62,17 @@ packages:
- kitchen-vagrant
- kwalify
chocolatey:
wanted:
firefox:
install_args: "l=fr-FR"
packagename:
version: '12.04'
source: 'mychocolatey/source'
force: true
unwanted:
- googlechrome
snaps:
wanted:
- hello-world