From d37d958a36be806bca9333fbe66cfda0a28e7d98 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 4 Nov 2021 19:17:35 -0700 Subject: [PATCH] Enable automatic updates & reboots on deploy box Oh right, like the SSH stuff, I did this the first time I set up, but didn't add it to the script! I like having things in the script :3 (I also had forgotten to check on the time zone last time, nice to have it with some rigor!) --- deploy/playbooks/setup.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/deploy/playbooks/setup.yml b/deploy/playbooks/setup.yml index 68e922e..1719402 100644 --- a/deploy/playbooks/setup.yml +++ b/deploy/playbooks/setup.yml @@ -48,6 +48,39 @@ state: enabled policy: deny + - name: Install unattended-upgrades + become: yes + apt: + update_cache: yes + name: unattended-upgrades + + - name: Enable unattended-upgrades to auto-upgrade our system + become: yes + copy: + content: | + APT::Periodic::Update-Package-Lists "1"; + APT::Periodic::Unattended-Upgrade "1"; + dest: /etc/apt/apt.conf.d/20auto-upgrades + + - name: Configure unattended-upgrades to auto-reboot our server when necessary + become: yes + lineinfile: + regex: ^(//\s*)?Unattended-Upgrade::Automatic-Reboot ".*";$ + line: Unattended-Upgrade::Automatic-Reboot "true"; + dest: /etc/apt/apt.conf.d/50unattended-upgrades + + - name: Configure unattended-upgrades to delay necessary reboots to 3am + become: yes + lineinfile: + regex: ^(//\s*)?Unattended-Upgrade::Automatic-Reboot-Time ".*";$ + line: Unattended-Upgrade::Automatic-Reboot-Time "03:00"; + dest: /etc/apt/apt.conf.d/50unattended-upgrades + + - name: Configure the system timezone to be US Pacific time + become: yes + community.general.timezone: + name: America/Los_Angeles + - name: Create the app versions folder become: yes file: