Commit cd3d355f authored by nimrod's avatar nimrod
Browse files

Daily background updates for Debian systems.

parent cf68c56a
Loading
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
#!/bin/sh
set -eu

apt-get update
apt-get dist-upgrade --download-only --yes
apt-get autoclean

if command -v flatpak >/dev/null 2>&1
then
    flatpak --system update --appstream
    flatpak --system update --assumeyes
    flatpak --system uninstall --unused --assumeyes
fi
+8 −0
Original line number Diff line number Diff line
[Unit]
Description=Background system updates
ConditionACPower=true
After=network-online.target

[Service]
Type=oneshot
ExecStart=daily
+8 −0
Original line number Diff line number Diff line
[Unit]
Description=Background system updates

[Timer]
OnCalendar=daily

[Install]
WantedBy=multi-user.target
+33 −0
Original line number Diff line number Diff line
@@ -208,3 +208,36 @@
    mode: preserve
    owner: root
    src: btrfs-backup

- name: Mail aliases
  loop:
    - root
    - nimrod
  ansible.builtin.lineinfile:
    backup: true
    create: true
    line: '{{ item }}: {{ item }}@shore.co.il'
    path: /etc/aliases
    regexp: '^{{ item }}:'
    state: present

- name: Copy update script
  ansible.builtin.copy:
    dest: /usr/local/sbin/daily
    mode: 0o0755
    src: daily

- name: Copy update service and timer
  loop:
    - update.service
    - update.timer
  ansible.builtin.copy:
    dest: /etc/systemd/system
    mode: 0o0644
    src: '{{ item }}'

- name: Enable the update timer
  ansible.builtin.systemd:
    enabled: true
    name: update.timer
    state: started