|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# vim: ft=sls |
| 3 | +{% from "packages/map.jinja" import packages with context %} |
| 4 | +
|
| 5 | +{% if grains['os'] == 'Windows' %} |
| 6 | +
|
| 7 | +{% if packages.chocolatey %} |
| 8 | +{% set req_states = packages.chocolatey.required.states %} |
| 9 | +{% set req_pkgs = packages.chocolatey.required.pkgs %} |
| 10 | +{% set wanted_chocolatey = packages.chocolatey.wanted %} |
| 11 | +{% set unwanted_chocolatey = packages.chocolatey.unwanted %} |
| 12 | +
|
| 13 | +{% if req_states %} |
| 14 | +include: |
| 15 | + {% for dep in req_states %} |
| 16 | + - {{ dep }} |
| 17 | + {% endfor %} |
| 18 | +{% endif %} |
| 19 | +
|
| 20 | +chocolatey_req_pkgs: |
| 21 | + pkg.installed: |
| 22 | + - pkgs: {{ req_pkgs | json }} |
| 23 | + - retry: {{ packages.retry_options|json }} |
| 24 | +
|
| 25 | +### CHOCOLATEY PACKAGES to install |
| 26 | +{% if wanted_chocolatey %} |
| 27 | +{% for choco, settings in wanted_chocolatey.items() %} |
| 28 | +{{ choco }}: |
| 29 | + chocolatey.installed: |
| 30 | + - name: {{ choco }} |
| 31 | + - version: {{ '' if 'version' not in settings else settings.version }} |
| 32 | + - source: {{ '' if 'source' not in settings else settings.source }} |
| 33 | + - force: {{ False if 'force' not in settings else settings.force }} |
| 34 | + - pre_versions: {{ False if 'pre_versions' not in settings else settings.pre_versions }} |
| 35 | + - install_args: {{ '' if 'install_args' not in settings else settings.install_args }} |
| 36 | + - override_args: {{ False if 'override_args' not in settings else settings.override_args }} |
| 37 | + - force_x86: {{ False if 'force_x86' not in settings else settings.force_x86 }} |
| 38 | + - package_args: {{ '' if 'package_args' not in settings else settings.package_args }} |
| 39 | + - allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }} |
| 40 | +{% endfor %} |
| 41 | +{% endif %} |
| 42 | +
|
| 43 | +### CHOCOLATEY PACKAGES to uninstall |
| 44 | +{% if unwanted_chocolatey %} |
| 45 | +{% for uchoco in unwanted_chocolatey %} |
| 46 | +{{ uchoco }}: |
| 47 | + chocolatey.uninstalled: |
| 48 | + - name: {{ uchoco }} |
| 49 | +{% endfor %} |
| 50 | +{% endif %} |
| 51 | +{% endif %} |
| 52 | +
|
| 53 | +{% endif %} |
0 commit comments