From: Frank Brehm Date: Wed, 17 Mar 2021 10:16:07 +0000 (+0100) Subject: Adding snippets for configuring rsyslogd X-Git-Tag: 2.2.5^2~5^2~2 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=23075bf9819a13cdff19c81f74929413928e365b;p=pixelpark%2Fcreate-vmware-tpl.git Adding snippets for configuring rsyslogd --- diff --git a/snippets/tpl.080.rsyslogd-el7.sh b/snippets/tpl.080.rsyslogd-el7.sh new file mode 100644 index 0000000..d8c8df4 --- /dev/null +++ b/snippets/tpl.080.rsyslogd-el7.sh @@ -0,0 +1,58 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +set_rsyslogd_el7() { + + echo + echo "${HASH_LINE}" + echo "Calling set_rsyslogd_el7() ..." + echo + local url_top="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/rsyslog.conf" + local url_sub="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/50_rsyslog.conf.el7" + + echo + log "Configuring Rsyslogd." + + echo + log "Cleaning /etc/rsyslog.d ..." + if [[ -d /etc/rsyslog.d ]] ; then + local cfg_file= + for cfg_file in /etc/rsyslog.d/*.conf ; do + if [[ -f "${cfg_file}" ]] ; then + rm -fv "${cfg_file}" + fi + done + else + mkdir -pv /etc/rsyslog.d + fi + + echo + log "Rewriting /etc/rsyslog.conf ..." + + local tmp_file=$( mktemp ) + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url_top}" || true + if [[ -s "${tmp_file}" ]] ; then + cp -p /etc/rsyslog.conf /etc/rsyslog.conf.orig + mv -v "${tmp_file}" /etc/rsyslog.conf + chmod -v 0644 /etc/rsyslog.conf + fi + rm -fv "${tmp_file}" + + echo + log "Rewriting /etc/rsyslog.d/50_rsyslog.conf ..." + + tmp_file=$( mktemp ) + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url_sub}" || true + if [[ -s "${tmp_file}" ]] ; then + mv -v "${tmp_file}" /etc/rsyslog.d/50_rsyslog.conf + chmod -v 0644 /etc/rsyslog.d/50_rsyslog.conf + fi + rm -fv "${tmp_file}" + +} + +set_rsyslogd_el7 + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.080.rsyslogd-el8.sh b/snippets/tpl.080.rsyslogd-el8.sh new file mode 100644 index 0000000..a46bb3c --- /dev/null +++ b/snippets/tpl.080.rsyslogd-el8.sh @@ -0,0 +1,58 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +set_rsyslogd_el8() { + + echo + echo "${HASH_LINE}" + echo "Calling set_rsyslogd_el8() ..." + echo + local url_top="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/rsyslog.conf" + local url_sub="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/50_rsyslog.conf.el8" + + echo + log "Configuring Rsyslogd." + + echo + log "Cleaning /etc/rsyslog.d ..." + if [[ -d /etc/rsyslog.d ]] ; then + local cfg_file= + for cfg_file in /etc/rsyslog.d/*.conf ; do + if [[ -f "${cfg_file}" ]] ; then + rm -fv "${cfg_file}" + fi + done + else + mkdir -pv /etc/rsyslog.d + fi + + echo + log "Rewriting /etc/rsyslog.conf ..." + + local tmp_file=$( mktemp ) + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url_top}" || true + if [[ -s "${tmp_file}" ]] ; then + cp -p /etc/rsyslog.conf /etc/rsyslog.conf.orig + mv -v "${tmp_file}" /etc/rsyslog.conf + chmod -v 0644 /etc/rsyslog.conf + fi + rm -fv "${tmp_file}" + + echo + log "Rewriting /etc/rsyslog.d/50_rsyslog.conf ..." + + tmp_file=$( mktemp ) + wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url_sub}" || true + if [[ -s "${tmp_file}" ]] ; then + mv -v "${tmp_file}" /etc/rsyslog.d/50_rsyslog.conf + chmod -v 0644 /etc/rsyslog.d/50_rsyslog.conf + fi + rm -fv "${tmp_file}" + +} + +set_rsyslogd_el8 + +#end raw +## vim: ts=4 et list