mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-17 10:10:27 +00:00
feat(chocolatey): add chocolatey management support
This commit is contained in:
parent
5d59759d60
commit
c0c1195242
6 changed files with 85 additions and 0 deletions
|
@ -224,6 +224,24 @@ to install, in the format:
|
||||||
|
|
||||||
``name: url``
|
``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
|
Testing
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
43
packages/chocolatey.sls
Normal file
43
packages/chocolatey.sls
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
{% from "packages/map.jinja" import packages with context %}
|
||||||
|
|
||||||
|
{% 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
|
||||||
|
{% 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 %}
|
||||||
|
|
||||||
|
### CHOCOLATEY PACKAGES to uninstall
|
||||||
|
{% for uchoco in unwanted_chocolatey %}
|
||||||
|
{{ uchoco }}:
|
||||||
|
chocolatey.uninstalled:
|
||||||
|
- name: {{ uchoco }}
|
||||||
|
{% endfor %}
|
|
@ -25,6 +25,12 @@ packages:
|
||||||
required:
|
required:
|
||||||
states: []
|
states: []
|
||||||
pkgs: []
|
pkgs: []
|
||||||
|
chocolatey:
|
||||||
|
wanted: []
|
||||||
|
unwanted: []
|
||||||
|
required:
|
||||||
|
states: []
|
||||||
|
pkgs: []
|
||||||
npms:
|
npms:
|
||||||
wanted: []
|
wanted: []
|
||||||
unwanted: []
|
unwanted: []
|
||||||
|
|
|
@ -10,3 +10,4 @@ include:
|
||||||
- packages.archives
|
- packages.archives
|
||||||
- packages.snaps
|
- packages.snaps
|
||||||
- packages.golang
|
- packages.golang
|
||||||
|
- packages.chocolatey
|
||||||
|
|
|
@ -46,3 +46,9 @@ FreeBSD:
|
||||||
pkgs:
|
pkgs:
|
||||||
- lang/ruby25
|
- lang/ruby25
|
||||||
- devel/ruby-gems
|
- devel/ruby-gems
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
chocolatey:
|
||||||
|
required:
|
||||||
|
pkgs:
|
||||||
|
- chocolatey
|
||||||
|
|
|
@ -62,6 +62,17 @@ packages:
|
||||||
- kitchen-vagrant
|
- kitchen-vagrant
|
||||||
- kwalify
|
- kwalify
|
||||||
|
|
||||||
|
chocolatey:
|
||||||
|
wanted:
|
||||||
|
firefox:
|
||||||
|
install_args: "l=fr-FR"
|
||||||
|
packagename:
|
||||||
|
version: '12.04'
|
||||||
|
source: 'mychocolatey/source'
|
||||||
|
force: true
|
||||||
|
unwanted:
|
||||||
|
- googlechrome
|
||||||
|
|
||||||
snaps:
|
snaps:
|
||||||
wanted:
|
wanted:
|
||||||
- hello-world
|
- hello-world
|
||||||
|
|
Loading…
Add table
Reference in a new issue