> For the complete documentation index, see [llms.txt](https://thorstenkramm.gitbook.io/saltstack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thorstenkramm.gitbook.io/saltstack/salt-fuer-windows/software-repository.md).

# Software Repository

Legen Sie einen Ordnder an, in welchem die Windows-Software gespeichert wird. Der vorgesehene Standard ist `/srv/salt/win/repo-ng`.

```bash
mkdir -p /srv/salt/win/repo-ng
```

### Softwaredownloads aus dem Internet

Legen Sie als nächstes eine Beschreibung einer Software an. Anhand dieser Beschreibung weiß der Minion, welche Versionen verfügbar sind und die Software installiert wird. Beispiel Firefox, welcher bei jeder Installation aus dem Internet geladen wird.

{% code title="/srv/salt/win/repo-ng/firefox.sls" %}

```yaml
firefox:
  {% if grains['cpuarch'] == 'AMD64' %}
    {% set PROGRAM_FILES = "%ProgramFiles(x86)%" %}
  {% else %}
    {% set PROGRAM_FILES = "%ProgramFiles%" %}
  {% endif %}
  {% for version in ['66.0.5','66.0.1', '66.0', '65.0.2', '65.0.1'] %}
  '{{ version }}':
    full_name: 'Mozilla Firefox {{ version }} (x86 en-US)'
    installer: 'https://download-installer.cdn.mozilla.net/pub/firefox/releases/{{ version }}/win32/en-US/Firefox%20Setup%20{{ version }}.exe'
    install_flags: '/s'
    uninstaller: '{{ PROGRAM_FILES }}\Mozilla Firefox\uninstall\helper.exe'
    uninstall_flags: '/S'
    msiexec: False
    locale: en_US
    reboot: False
  {% endfor %}
```

{% endcode %}

Prüfen Sie Sie das Repoistory beispielweise mit dem folgenden Kommando, welches auflistet, welche Firefox Version vom Salt Master bereit gehalten werden.

```
salt -G "os:windows" pkg.refresh_db
salt -G "os:windows" pkg.list_available firefox
```

Wenn dieser Schritt erfolgreich war, können Sie Firefox per Modul oder State installieren.

```
salt -G "os:windows" pkg.install firefox
```

{% code title="/srv/salt/windows/base-software.sls" %}

```yaml
firefox:
  pkg.installed: []
```

{% endcode %}

### Software lokal speichern und ausliefern

Zur Schnung der Bandbreite oder aus Sicherheitsgründen ist es nicht immer ratsam, Software direkt aus dem Internet zu laden. Sie können diese auf dem Salt Master speichern und von dort verteilen.

Laden Sie beispielweise die 64bit Windows-Version von VSCode auf den Salt Master herunter.

![Download von VSCode](/files/-LeVWMfQ1sVFRfar9m72)

```bash
mkdir -p /srv/salt/win/repo-ng/vscode
cd /srv/salt/win/repo-ng/vscode
wget "https://az764295.vo.msecnd.net/stable/51b0b28134d51361cf996d2f0a1c698247aeabd8/VSCodeSetup-x64-1.33.1.exe"
```

{% code title="/srv/salt/win/repo-ng/vscode/init.sls" %}

```yaml
# due to winrepo installer limitations you need to manually download x86 + x64 System installer from
# https://code.visualstudio.com/Download
# and put it on the winrepo on master to install it the 'salt://win/repo-ng/vscode/...

{% set version = '1.33.1' %}
{% set PROGRAM_FILES = "%ProgramFiles%" %}

vscode:
  '{{version}}':
    full_name: 'Microsoft Visual Studio Code'
    installer: 'salt://win/repo-ng/vscode/VSCodeSetup-x64-{{ version }}.exe'
    uninstaller: 'C:{{ PROGRAM_FILES }}\Microsoft VS Code\unins000.exe'
    install_flags: '/SP- /VERYSILENT /NORESTART /MERGETASKS=!RUNCODE'
    uninstall_flags: '/VERYSILENT /NORESTART'
    msiexec: False
    locale: en_US
    reboot: False
```

{% endcode %}

```
salt -G "os:windows" pkg.refresh_db
salt -G "os:windows" pkg.list_available vscode
```

![VScode wurde installiert](/files/-LeVX_j9uSCJneotSmvq)
