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: 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. # SSH configuration.
# ---------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------
@ -175,6 +145,26 @@
mail_postfix_conf is changed or mail_postfix_conf is changed or
mail_postfix_credentials is changed 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. # Fail2Ban configuration.
# ---------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------
@ -217,8 +207,8 @@
- name: SystemD mail script - name: SystemD mail script
template: template:
src: ./root/usr/local/bin/systemd-mail.j2 src: ./root/usr/local/sbin/systemd-mail-systemctl-status.j2
dest: /usr/local/bin/systemd-mail dest: /usr/local/sbin/systemd-mail-systemctl-status
mode: 0755 mode: 0755
- name: SystemD mail service - name: SystemD mail service
@ -240,8 +230,8 @@
- name: Zpool status mail script - name: Zpool status mail script
template: template:
src: ./root/usr/local/bin/zpool-status-mail.j2 src: ./root/usr/local/sbin/systemd-mail-zpool-status.j2
dest: /usr/local/bin/zpool-status-mail dest: /usr/local/sbin/systemd-mail-zpool-status
mode: 0755 mode: 0755
- name: Zfs scrub service file - name: Zfs scrub service file
@ -402,3 +392,13 @@
src: ./root/etc/motd src: ./root/etc/motd
dest: /etc/motd dest: /etc/motd
mode: 0644 mode: 0644
# ----------------------------------------------------------------------------------------------
# Utility programs.
# ----------------------------------------------------------------------------------------------
- name: Install utility programs
apt:
name:
- htop
- man

View File

@ -3,6 +3,6 @@ Description=Status email for %i
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/usr/local/bin/systemd-mail %i ExecStart=/usr/local/sbin/systemd-mail-systemctl-status %i
User=nobody User=nobody
Group=systemd-journal 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;\ exec /usr/sbin/zpool wait -t scrub %i;\
else exec /usr/sbin/zpool scrub -w %i; fi' else exec /usr/sbin/zpool scrub -w %i; fi'
ExecStop=-/bin/sh -c '/usr/sbin/zpool scrub -p %i 2>/dev/null || true' 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 /usr/sbin/sendmail -t <<SYSTEMDMAIL
To: root To: root
From: systemd <{{ hostname }}> From: systemd <systemd>
Subject: $1 Subject: systemctl status $1 on {{ hostname }}
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8

View File

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