This commit is contained in:
Wojciech Kozlowski 2022-08-30 20:27:32 +02:00
parent 7866690cb0
commit e1289404e9
5 changed files with 40 additions and 40 deletions

View File

@ -6,36 +6,6 @@
tasks:
# ----------------------------------------------------------------------------------------------
# Helpful utility programs to help with live system administration.
# ----------------------------------------------------------------------------------------------
- name: Install utility programs
apt:
name:
- htop
- man
# -------------------------------------------------------------------------
# Unattended upgrades configuration.
# -------------------------------------------------------------------------
- name: Install unattended-upgrades
apt:
name: unattended-upgrades
- name: Configure unattended-upgrades
copy:
src: ./root/etc/apt/apt.conf.d/50unattended-upgrades
dest: /etc/apt/apt.conf.d/50unattended-upgrades
mode: 0644
- name: Enable unattended-upgrades
copy:
src: ./root/etc/apt/apt.conf.d/20auto-upgrades
dest: /etc/apt/apt.conf.d/20auto-upgrades
mode: 0644
# ----------------------------------------------------------------------------------------------
# SSH configuration.
# ----------------------------------------------------------------------------------------------
@ -175,6 +145,26 @@
mail_postfix_conf is changed or
mail_postfix_credentials is changed
# -------------------------------------------------------------------------
# Unattended upgrades configuration.
# -------------------------------------------------------------------------
- name: Install unattended-upgrades
apt:
name: unattended-upgrades
- name: Configure unattended-upgrades
copy:
src: ./root/etc/apt/apt.conf.d/50unattended-upgrades
dest: /etc/apt/apt.conf.d/50unattended-upgrades
mode: 0644
- name: Enable unattended-upgrades
copy:
src: ./root/etc/apt/apt.conf.d/20auto-upgrades
dest: /etc/apt/apt.conf.d/20auto-upgrades
mode: 0644
# ----------------------------------------------------------------------------------------------
# Fail2Ban configuration.
# ----------------------------------------------------------------------------------------------
@ -217,8 +207,8 @@
- name: SystemD mail script
template:
src: ./root/usr/local/bin/systemd-mail.j2
dest: /usr/local/bin/systemd-mail
src: ./root/usr/local/sbin/systemd-mail-systemctl-status.j2
dest: /usr/local/sbin/systemd-mail-systemctl-status
mode: 0755
- name: SystemD mail service
@ -240,8 +230,8 @@
- name: Zpool status mail script
template:
src: ./root/usr/local/bin/zpool-status-mail.j2
dest: /usr/local/bin/zpool-status-mail
src: ./root/usr/local/sbin/systemd-mail-zpool-status.j2
dest: /usr/local/sbin/systemd-mail-zpool-status
mode: 0755
- name: Zfs scrub service file
@ -402,3 +392,13 @@
src: ./root/etc/motd
dest: /etc/motd
mode: 0644
# ----------------------------------------------------------------------------------------------
# Utility programs.
# ----------------------------------------------------------------------------------------------
- name: Install utility programs
apt:
name:
- htop
- man

View File

@ -3,6 +3,6 @@ Description=Status email for %i
[Service]
Type=oneshot
ExecStart=/usr/local/bin/systemd-mail %i
ExecStart=/usr/local/sbin/systemd-mail-systemctl-status %i
User=nobody
Group=systemd-journal

View File

@ -14,4 +14,4 @@ if /usr/sbin/zpool status %i | grep -q "scrub in progress"; then\
exec /usr/sbin/zpool wait -t scrub %i;\
else exec /usr/sbin/zpool scrub -w %i; fi'
ExecStop=-/bin/sh -c '/usr/sbin/zpool scrub -p %i 2>/dev/null || true'
ExecStopPost=/bin/sh -c '/usr/local/bin/zpool-status-mail %i'
ExecStopPost=/bin/sh -c '/usr/local/sbin/systemd-mail-zpool-status %i'

View File

@ -2,8 +2,8 @@
/usr/sbin/sendmail -t <<SYSTEMDMAIL
To: root
From: systemd <{{ hostname }}>
Subject: $1
From: systemd <systemd>
Subject: systemctl status $1 on {{ hostname }}
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8

View File

@ -2,8 +2,8 @@
/usr/sbin/sendmail -t <<SYSTEMDMAIL
To: root
From: systemd <{{ hostname }}>
Subject: zpool status $1
From: systemd <systemd>
Subject: zpool status $1 on {{ hostname }}
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8