From 812b86451fad7e116bd78ab635e4a04c1422c51c Mon Sep 17 00:00:00 2001
From: Emil Renner Berthing <esmil@labitat.dk>
Date: Sun, 7 Oct 2018 14:18:18 +0200
Subject: raspbian: apt: disable timers to save sd-card writes

---
 roles/raspbian/tasks/apt.yml  | 17 +++++++++++++++++
 roles/raspbian/tasks/main.yml |  2 ++
 2 files changed, 19 insertions(+)
 create mode 100644 roles/raspbian/tasks/apt.yml

(limited to 'roles')

diff --git a/roles/raspbian/tasks/apt.yml b/roles/raspbian/tasks/apt.yml
new file mode 100644
index 0000000..6194bda
--- /dev/null
+++ b/roles/raspbian/tasks/apt.yml
@@ -0,0 +1,17 @@
+---
+- name: Disable apt timers
+  systemd:
+    name: '{{ item }}'
+    enabled: no
+  with_items:
+  - apt-daily.timer
+  - apt-daily-upgrade.timer
+  when: not chroot
+- name: '- when in chroot'
+  command: 'systemctl disable {{ item }}'
+  with_items:
+  - apt-daily.timer
+  - apt-daily-upgrade.timer
+  when: chroot
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml
index 3200277..96fce1c 100644
--- a/roles/raspbian/tasks/main.yml
+++ b/roles/raspbian/tasks/main.yml
@@ -1,4 +1,6 @@
 ---
+- import_tasks: apt.yml
+  tags: apt
 - import_tasks: networkd.yml
   tags: networkd
 - import_tasks: remove_pi.yml
-- 
cgit v1.2.1