Ubuntu unattended upgrades the salt way

There are many ways to turn on the unattended upgrades in Ubuntu. Creating files in /etc/apt/apt.conf.d, reconfiguring the package by hand, reinstalling after debconf, etc.

Here’s a simple way to do it with salt without breaking the Ubuntu / debconf integration:

unattended-upgrades:
  debconf.set:
    - data:
        'unattended-upgrades/enable_auto_updates':
          type: boolean
          value: "true"

  cmd.wait:
    - name: "dpkg-reconfigure unattended-upgrades"
    - watch:
      - debconf: unattended-upgrades
    - env:
        DEBIAN_FRONTEND: noninteractive
        DEBCONF_NONINTERACTIVE_SEEN: "true"
Was it useful? BTC: 182DVfre4E7WNk3Qakc4aK7bh4fch51hTY

blogroll

social