From e4e84d22185ea8b12967f167d78d130dcf3221a2 Mon Sep 17 00:00:00 2001 From: mg Date: Sun, 7 Mar 2021 19:40:32 +0100 Subject: [PATCH] =?UTF-8?q?templates:=20Header-Var=20eingef=C3=BCgt=20(#22?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit python zu 3 rest zfs Postfix Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/22 Co-Authored-By: mg Co-Committed-By: mg --- group_vars/all.yml | 6 +++++- roles/mgrote.acng/templates/acng.conf | 1 + roles/mgrote.apcupsd/templates/apccontrol.save | 1 + roles/mgrote.apcupsd/templates/master_apcupsd.conf | 1 + roles/mgrote.apcupsd/templates/slave_apcupsd.conf | 1 + .../mgrote.apt_manage_sources/templates/ubuntu_sources.list | 1 + roles/mgrote.create_users/templates/.selected_editor | 2 +- roles/mgrote.cv4pve-autosnap/templates/cv4pve-script.sh | 1 + roles/mgrote.dokuwiki/templates/000-default.conf | 1 + roles/mgrote.dokuwiki/templates/apache2.conf | 1 + roles/mgrote.ecc-rasdaemon/templates/rasdaemon-cron.sh | 1 + roles/mgrote.fail2ban/templates/jail.local | 1 + roles/mgrote.fail2ban/templates/sendmail-common.local | 1 + roles/mgrote.fileserver_smb/templates/smb.conf.j2 | 1 + roles/mgrote.mount_cifs/templates/smb_passwords | 1 + roles/mgrote.musterrolle/templates/script.sh | 1 + roles/mgrote.ntp/templates/ntp.conf.j2 | 1 + roles/mgrote.postfix/templates/main.cf | 1 + roles/mgrote.postfix/templates/sasl_passwd | 1 + roles/mgrote.postfix/templates/sender_canonical | 1 + roles/mgrote.restic/templates/restic_backup.sh | 1 + roles/mgrote.smart/templates/smart_status.sh | 1 + roles/mgrote.smart/templates/smartctl_mail.sh | 1 + roles/mgrote.smart/templates/smartd.conf | 2 ++ roles/mgrote.zfs_health/templates/zfs-health.sh | 1 + roles/mgrote.zfs_packages/templates/zfs-free.sh | 1 + roles/mgrote.zfs_sanoid/templates/sanoid-cron.sh | 1 + roles/mgrote.zfs_sanoid/templates/sanoid.conf.j2 | 1 + roles/mgrote.zfs_zed/templates/zed.rc | 4 ++-- 29 files changed, 35 insertions(+), 4 deletions(-) diff --git a/group_vars/all.yml b/group_vars/all.yml index 91ae7113..99fd3dbb 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -1,6 +1,10 @@ --- ### wird in vielen Rollen verwendet empfaenger_mail: michael.grote@posteo.de + file_header: | + #------------------------------------------------------------------ + #- This file is managed with ansible! - + #------------------------------------------------------------------ ### mgrote.postfix postfix_absender_mailadresse: info@mgrote.net postfix_absender_passwort: "{{ lookup('keepass', 'postfix_absender_passwort', 'password') }}" @@ -88,7 +92,7 @@ ### mgrote.apt_install_packages programs_common: - locales - - python + - python3 - build-essential - ntp - htop diff --git a/roles/mgrote.acng/templates/acng.conf b/roles/mgrote.acng/templates/acng.conf index 16480f67..01fa71d3 100644 --- a/roles/mgrote.acng/templates/acng.conf +++ b/roles/mgrote.acng/templates/acng.conf @@ -1,3 +1,4 @@ +{{ file_header | default () }} # This is a configuration file for apt-cacher-ng, a smart caching proxy for # software package downloads. It's supposed to be in a directory specified by # the -c option of apt-cacher-ng, see apt-cacher-ng(8) for details. diff --git a/roles/mgrote.apcupsd/templates/apccontrol.save b/roles/mgrote.apcupsd/templates/apccontrol.save index db48c9dd..f8d74750 100644 --- a/roles/mgrote.apcupsd/templates/apccontrol.save +++ b/roles/mgrote.apcupsd/templates/apccontrol.save @@ -1,3 +1,4 @@ +{{ file_header | default () }} #!@SCRIPTSHELL@ # # Safe apccontrol for testing. diff --git a/roles/mgrote.apcupsd/templates/master_apcupsd.conf b/roles/mgrote.apcupsd/templates/master_apcupsd.conf index b2bf497a..ea6b0b49 100644 --- a/roles/mgrote.apcupsd/templates/master_apcupsd.conf +++ b/roles/mgrote.apcupsd/templates/master_apcupsd.conf @@ -1,3 +1,4 @@ +{{ file_header | default () }} ## apcupsd.conf v1.1 ## UPSCABLE usb diff --git a/roles/mgrote.apcupsd/templates/slave_apcupsd.conf b/roles/mgrote.apcupsd/templates/slave_apcupsd.conf index 35bc0c33..e200dde4 100644 --- a/roles/mgrote.apcupsd/templates/slave_apcupsd.conf +++ b/roles/mgrote.apcupsd/templates/slave_apcupsd.conf @@ -1,3 +1,4 @@ +{{ file_header | default () }} ## apcupsd.conf v1.1 ## UPSCABLE ether diff --git a/roles/mgrote.apt_manage_sources/templates/ubuntu_sources.list b/roles/mgrote.apt_manage_sources/templates/ubuntu_sources.list index e5551010..df61d087 100644 --- a/roles/mgrote.apt_manage_sources/templates/ubuntu_sources.list +++ b/roles/mgrote.apt_manage_sources/templates/ubuntu_sources.list @@ -1,3 +1,4 @@ +{{ file_header | default () }} deb http://{{ manage_sources_apt_proxy_url }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} main restricted deb http://{{ manage_sources_apt_proxy_url }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates main restricted deb http://{{ manage_sources_apt_proxy_url }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} universe diff --git a/roles/mgrote.create_users/templates/.selected_editor b/roles/mgrote.create_users/templates/.selected_editor index 98be1bf1..46071ad8 100644 --- a/roles/mgrote.create_users/templates/.selected_editor +++ b/roles/mgrote.create_users/templates/.selected_editor @@ -1,2 +1,2 @@ -# Generated by /usr/bin/select-editor +{{ file_header | default () }} SELECTED_EDITOR="/usr/bin/vim" diff --git a/roles/mgrote.cv4pve-autosnap/templates/cv4pve-script.sh b/roles/mgrote.cv4pve-autosnap/templates/cv4pve-script.sh index fcee837a..3768fe6b 100644 --- a/roles/mgrote.cv4pve-autosnap/templates/cv4pve-script.sh +++ b/roles/mgrote.cv4pve-autosnap/templates/cv4pve-script.sh @@ -1,4 +1,5 @@ #!/bin/bash +{{ file_header | default () }} LOCKDIR=${HOME}/.cache function exlock() { exec {lock_fd}>${LOCKDIR}/$(basename $0).lock diff --git a/roles/mgrote.dokuwiki/templates/000-default.conf b/roles/mgrote.dokuwiki/templates/000-default.conf index 2c8b6ad7..1e34f338 100644 --- a/roles/mgrote.dokuwiki/templates/000-default.conf +++ b/roles/mgrote.dokuwiki/templates/000-default.conf @@ -1,3 +1,4 @@ +{{ file_header | default () }} # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating diff --git a/roles/mgrote.dokuwiki/templates/apache2.conf b/roles/mgrote.dokuwiki/templates/apache2.conf index 18c8f20a..b52cd6f8 100644 --- a/roles/mgrote.dokuwiki/templates/apache2.conf +++ b/roles/mgrote.dokuwiki/templates/apache2.conf @@ -1,3 +1,4 @@ +{{ file_header | default () }} # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See http://httpd.apache.org/docs/2.4/ for detailed information about diff --git a/roles/mgrote.ecc-rasdaemon/templates/rasdaemon-cron.sh b/roles/mgrote.ecc-rasdaemon/templates/rasdaemon-cron.sh index 156e1133..2f996efa 100644 --- a/roles/mgrote.ecc-rasdaemon/templates/rasdaemon-cron.sh +++ b/roles/mgrote.ecc-rasdaemon/templates/rasdaemon-cron.sh @@ -1,4 +1,5 @@ #!/bin/bash +{{ file_header | default () }} ##################### ## https://www.tothenew.com/blog/foolproof-your-bash-script-some-best-practices/ set -o nounset diff --git a/roles/mgrote.fail2ban/templates/jail.local b/roles/mgrote.fail2ban/templates/jail.local index 3485e9e6..594f0e81 100644 --- a/roles/mgrote.fail2ban/templates/jail.local +++ b/roles/mgrote.fail2ban/templates/jail.local @@ -1,3 +1,4 @@ +{{ file_header | default () }} [DEFAULT] ignorself = true ignoreip = 127.0.0.1/8 ::1 diff --git a/roles/mgrote.fail2ban/templates/sendmail-common.local b/roles/mgrote.fail2ban/templates/sendmail-common.local index 3f32cfcd..8773c960 100644 --- a/roles/mgrote.fail2ban/templates/sendmail-common.local +++ b/roles/mgrote.fail2ban/templates/sendmail-common.local @@ -1,3 +1,4 @@ +{{ file_header | default () }} [Definition] actionstart = actionstop = diff --git a/roles/mgrote.fileserver_smb/templates/smb.conf.j2 b/roles/mgrote.fileserver_smb/templates/smb.conf.j2 index ee43f6e1..b1c0dac6 100644 --- a/roles/mgrote.fileserver_smb/templates/smb.conf.j2 +++ b/roles/mgrote.fileserver_smb/templates/smb.conf.j2 @@ -1,3 +1,4 @@ +{{ file_header | default () }} #======================= Global Settings ======================= [global] min protocol = {{ smb_min_protocol }} diff --git a/roles/mgrote.mount_cifs/templates/smb_passwords b/roles/mgrote.mount_cifs/templates/smb_passwords index 046562c8..bcd29a6e 100644 --- a/roles/mgrote.mount_cifs/templates/smb_passwords +++ b/roles/mgrote.mount_cifs/templates/smb_passwords @@ -1,3 +1,4 @@ +{{ file_header | default () }} {% for item in cifs_mounts %} username={{ item.user }} password={{ item.password }} diff --git a/roles/mgrote.musterrolle/templates/script.sh b/roles/mgrote.musterrolle/templates/script.sh index 736a9fa0..1d8d4193 100644 --- a/roles/mgrote.musterrolle/templates/script.sh +++ b/roles/mgrote.musterrolle/templates/script.sh @@ -1,4 +1,5 @@ #!/bin/bash +{{ file_header | default () }} ##################### ## https://www.tothenew.com/blog/foolproof-your-bash-script-some-best-practices/ set -o nounset diff --git a/roles/mgrote.ntp/templates/ntp.conf.j2 b/roles/mgrote.ntp/templates/ntp.conf.j2 index d1c48e31..e6f4c292 100644 --- a/roles/mgrote.ntp/templates/ntp.conf.j2 +++ b/roles/mgrote.ntp/templates/ntp.conf.j2 @@ -1,3 +1,4 @@ +{{ file_header | default () }} # Servers {% for item in ntp_servers %} server {{ item.address }} {{ item.options |default() }} diff --git a/roles/mgrote.postfix/templates/main.cf b/roles/mgrote.postfix/templates/main.cf index cea9b28a..008cf7d7 100644 --- a/roles/mgrote.postfix/templates/main.cf +++ b/roles/mgrote.postfix/templates/main.cf @@ -1,3 +1,4 @@ +{{ file_header | default () }} relayhost = [{{ postfix_smtp_server }}]:{{ postfix_smtp_server_port }} smtp_use_tls = {{ postfix_smtp_use_tls }} smtp_sasl_auth_enable = {{ postfix_smtp_sasl_auth_enable }} diff --git a/roles/mgrote.postfix/templates/sasl_passwd b/roles/mgrote.postfix/templates/sasl_passwd index 31c5492d..e4dcd124 100644 --- a/roles/mgrote.postfix/templates/sasl_passwd +++ b/roles/mgrote.postfix/templates/sasl_passwd @@ -1 +1,2 @@ +{{ file_header | default () }} {{ postfix_smtp_server }} {{ postfix_absender_mailadresse }}:{{ postfix_absender_passwort }} diff --git a/roles/mgrote.postfix/templates/sender_canonical b/roles/mgrote.postfix/templates/sender_canonical index a77cfc7d..2b417307 100644 --- a/roles/mgrote.postfix/templates/sender_canonical +++ b/roles/mgrote.postfix/templates/sender_canonical @@ -1 +1,2 @@ +{{ file_header | default () }} /.+/ {{ postfix_absender_mailadresse }} diff --git a/roles/mgrote.restic/templates/restic_backup.sh b/roles/mgrote.restic/templates/restic_backup.sh index a6d5cb94..040557f6 100644 --- a/roles/mgrote.restic/templates/restic_backup.sh +++ b/roles/mgrote.restic/templates/restic_backup.sh @@ -1,4 +1,5 @@ #!/bin/bash +{{ file_header | default () }} LOCKDIR=${HOME}/.cache # set lockdir function exlock() { # define Function for setting lock; stops the script i a lock exists exec {lock_fd}>${LOCKDIR}/$(basename $0).lock diff --git a/roles/mgrote.smart/templates/smart_status.sh b/roles/mgrote.smart/templates/smart_status.sh index ed16dc73..093539af 100644 --- a/roles/mgrote.smart/templates/smart_status.sh +++ b/roles/mgrote.smart/templates/smart_status.sh @@ -1,4 +1,5 @@ #!/bin/bash +{{ file_header | default () }} for i in {a..z}; do smartctl /dev/sd$i -a | grep "Device Model: " smartctl /dev/sd$i -a | grep "SMART overall-health self-assessment test result: " | sed -r 's/SMART overall-health self-assessment test result: /SMART test result: /g'| sed -r "s/(PASSED)/`printf "\033[92m"`\1`printf "\033[0m"`/g" | sed -r "s/(FAILED)/`printf "\033[31m"`\1`printf "\033[0m"`/g" diff --git a/roles/mgrote.smart/templates/smartctl_mail.sh b/roles/mgrote.smart/templates/smartctl_mail.sh index fc2bec02..940930fe 100644 --- a/roles/mgrote.smart/templates/smartctl_mail.sh +++ b/roles/mgrote.smart/templates/smartctl_mail.sh @@ -1,4 +1,5 @@ #!/bin/bash +{{ file_header | default () }} for i in {a..z}; do {{ smart_smartctl_mail_pfad_smartctl }} /dev/sd$i -a done diff --git a/roles/mgrote.smart/templates/smartd.conf b/roles/mgrote.smart/templates/smartd.conf index 784913b2..14ee1d4e 100644 --- a/roles/mgrote.smart/templates/smartd.conf +++ b/roles/mgrote.smart/templates/smartd.conf @@ -1,3 +1,5 @@ +{{ file_header | default () }} + # Reihenfolge der Zeilen ist wichtig # Mail nach Neustart diff --git a/roles/mgrote.zfs_health/templates/zfs-health.sh b/roles/mgrote.zfs_health/templates/zfs-health.sh index 40ccff0a..aa4ab3f6 100644 --- a/roles/mgrote.zfs_health/templates/zfs-health.sh +++ b/roles/mgrote.zfs_health/templates/zfs-health.sh @@ -1,4 +1,5 @@ #! /bin/bash +{{ file_header | default () }} problems=0 emailSubject="`hostname` - ZFS pool - HEALTH check" diff --git a/roles/mgrote.zfs_packages/templates/zfs-free.sh b/roles/mgrote.zfs_packages/templates/zfs-free.sh index d4f45ad8..1a4c04d9 100644 --- a/roles/mgrote.zfs_packages/templates/zfs-free.sh +++ b/roles/mgrote.zfs_packages/templates/zfs-free.sh @@ -1,2 +1,3 @@ #! /bin/bash +{{ file_header | default () }} watch --interval 60 --differences --color --no-title "sudo zfs list -o space | grep -v / | tr -s ' ' | cut --delimiter=' ' --fields=1-3 | sed -r 's/\s/\t\t/g;s/NAME/NAME\t/g'" diff --git a/roles/mgrote.zfs_sanoid/templates/sanoid-cron.sh b/roles/mgrote.zfs_sanoid/templates/sanoid-cron.sh index 3d6b01bb..1e07279b 100644 --- a/roles/mgrote.zfs_sanoid/templates/sanoid-cron.sh +++ b/roles/mgrote.zfs_sanoid/templates/sanoid-cron.sh @@ -1,4 +1,5 @@ #!/bin/bash +{{ file_header | default () }} export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LOCKDIR=${HOME}/.cache diff --git a/roles/mgrote.zfs_sanoid/templates/sanoid.conf.j2 b/roles/mgrote.zfs_sanoid/templates/sanoid.conf.j2 index 2e7fff6b..a0bea3c2 100644 --- a/roles/mgrote.zfs_sanoid/templates/sanoid.conf.j2 +++ b/roles/mgrote.zfs_sanoid/templates/sanoid.conf.j2 @@ -1,3 +1,4 @@ +{{ file_header | default () }} ## ZFS Section -------------------------------- ## {% for item in sanoid_datasets %} [{{ item.path }}] diff --git a/roles/mgrote.zfs_zed/templates/zed.rc b/roles/mgrote.zfs_zed/templates/zed.rc index 3bcab717..e99c7979 100644 --- a/roles/mgrote.zfs_zed/templates/zed.rc +++ b/roles/mgrote.zfs_zed/templates/zed.rc @@ -1,9 +1,9 @@ - +{{ file_header | default () }} ## # zed.rc # # This file should be owned by root and permissioned 0600. -## +## ## # Absolute path to the debug output file.