> 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/beispiele/unattended-upgrades.md).

# Unattended Upgrades

Folgender State installiert das benötigte Paket und verteilt die Konfigurationsdatei. Je nach Distribution und Version muss eine unterschiedliche Konfiguration verwendet werden.

Die Konfigurationsdatei wird von Jinja »bearbeitet«, sodass Sie einzelne Zeilen oder Werte per Pillar setzen können.

{% code title="/srv/salt/unattended-upgrades/init.sls" lineNumbers="true" fullWidth="false" %}

```yaml
{% set src_conf = "50unattended-upgrades." + grains['os']|lower %}
unattended-upgrades:
  pkg.installed: []

/etc/apt/apt.conf.d/50unattended-upgrades:
  file.managed:
    - source: salt://unattended-upgrades/{{ src_conf }}
    - template: jinja

unattended-upgrades.service:
  service.running:
    - enable: True
    - watch:
      - file: /etc/apt/apt.conf.d/50unattended-upgrades
```

{% endcode %}

Nachfolgend ein Ausschnitt aus der Konfigurationsdatei, das zeigt, wie Sie über Pillars einzelne Zeilen aktivieren oder deaktivieren, Zeilen 7–12.

{% code lineNumbers="true" %}

```
Unattended-Upgrade::Origins-Pattern {
        // Codename based matching:
        // This will follow the migration of a release through different
        // archives (e.g. from testing to stable and later oldstable).
        // Software will be the latest available for the named release,
        // but the Debian release itself will not be automatically upgraded.
        {% if salt.pillar.get('unattended_upgrades:updates',False) -%}
        "origin=Debian,codename=${distro_codename}-updates";
        {%- endif %}
        {% if salt.pillar.get('unattended_upgrades:proposed_updates',False) -%}
        "origin=Debian,codename=${distro_codename}-proposed-updates";
        {%- endif %}
        "origin=Debian,codename=${distro_codename},label=Debian";
        "origin=Debian,codename=${distro_codename},label=Debian-Security";
        "origin=Debian,codename=${distro_codename}-security,label=Debian-Security";

        // Archive or Suite based matching:
        // Note that this will silently match a different release after
        // migration to the specified archive (e.g. testing becomes the
        // new stable).
//      "o=Debian,a=stable";
//      "o=Debian,a=stable-updates";
//      "o=Debian,a=proposed-updates";
//      "o=Debian Backports,a=${distro_codename}-backports,l=Debian Backports";
};
```

{% endcode %}

<figure><img src="/files/erIfJVuauOm4dmjvdFj2" alt=""><figcaption><p>Jinja in beliebiger Textdatei</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://thorstenkramm.gitbook.io/saltstack/beispiele/unattended-upgrades.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
