Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unattended upgrades + some other basic settings #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions roles/common/files/20auto-upgrades
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
10 changes: 8 additions & 2 deletions roles/common/handlers/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
- name: Restart sshd
- name: restart sshd
service:
name: sshd
state: restarted
state: restarted

- name: restart journal
service:
name: systemd-journald
state: restarted
enabled: yes
1 change: 1 addition & 0 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
- include: upgrade.yml
- include: packages.yml
- include: system.yml
- include: ssh.yml
2 changes: 1 addition & 1 deletion roles/common/tasks/ssh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
dest: "/etc/ssh/sshd_config"
regexp: "^#?PermitRootLogin "
line: "PermitRootLogin without-password"
notify: "Restart sshd"
notify: "restart sshd"
38 changes: 38 additions & 0 deletions roles/common/tasks/system.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
- name: Set timezone to Berlin
community.general.timezone:
name: Europe/Berlin

- name: Limit syslogs
lineinfile:
dest: /etc/systemd/journald.conf
regexp: "^#?\\s*SystemMaxFileSize"
line: "SystemMaxFileSize=2G"
notify: restart journal

- name: Set vim as default editor
alternatives:
name: editor
path: /usr/bin/vim.basic

- name: Allow unattended reboots (1)
lineinfile:
dest: /etc/apt/apt.conf.d/50unattended-upgrades
regexp: "^(//)?Unattended-Upgrade::Automatic-Reboot "
line: "Unattended-Upgrade::Automatic-Reboot \"true\";"

- name: Allow unattended reboots (2)
lineinfile:
dest: /etc/apt/apt.conf.d/50unattended-upgrades
regexp: "^(//)?Unattended-Upgrade::Automatic-Reboot-Time "
line: "Unattended-Upgrade::Automatic-Reboot-Time \"23:55\";"

- name: Allow more origins for updates
lineinfile:
dest: /etc/apt/apt.conf.d/50unattended-upgrades
regexp: "^(//\\s*)?\"\\$\\{distro_id\\}:\\$\\{distro_codename\\}-updates\";"
line: "\"${distro_id}:${distro_codename}-updates\";"

- name: Enable unattended upgrades
copy:
src: 20auto-upgrades
dest: /etc/apt/apt.conf.d/20auto-upgrades