27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
include:
|
|
- chocolatey
|
|
|
|
{% import_yaml "./packages.yaml" as packages %}
|
|
|
|
# Install packages which are not installed
|
|
{% set installed_pkg_lines = salt['cmd.run']("if (Get-Command choco -ErrorAction SilentlyContinue) { choco list --local-only -r }", shell="powershell").splitlines() %}
|
|
{% set installed_pkg = installed_pkg_lines|map('method_call', 'split', '|', 1)|map(attribute=0)|map('lower')|list %}
|
|
{% for pkg in packages|difference(installed_pkg) %}
|
|
"install {{ pkg }}":
|
|
chocolatey.installed:
|
|
- name: {{ pkg }}
|
|
- require:
|
|
- sls: chocolatey
|
|
{% endfor %}
|
|
|
|
# Update only packages that need updating
|
|
{% set outdated_pkg_lines = salt['cmd.run']("if (Get-Command choco -ErrorAction SilentlyContinue) { choco outdated -r --ignore-unfound }", shell="powershell").splitlines() %}
|
|
{% set outdated_pkg = outdated_pkg_lines|map('method_call', 'split', '|', 1)|map(attribute=0) %}
|
|
{% for pkg in outdated_pkg|difference(['chitubox', 'sketchup', 'autodesk-fusion360']) %}
|
|
"update {{ pkg }}":
|
|
chocolatey.upgraded:
|
|
- name: "{{ pkg }}"
|
|
- require:
|
|
- chocolateyBootstrap
|
|
{% endfor %}
|