Initial commit
This commit is contained in:
parent
46a6f7d3ec
commit
49ba7cd121
40 changed files with 1121 additions and 0 deletions
2
roles/base/templates/20auto-upgrades.j2
Normal file
2
roles/base/templates/20auto-upgrades.j2
Normal file
|
@ -0,0 +1,2 @@
|
|||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "1";
|
|
@ -0,0 +1,4 @@
|
|||
[Timer]
|
||||
OnCalendar=
|
||||
OnCalendar=02:15
|
||||
RandomizedDelaySec=0
|
4
roles/base/templates/apt-daily.timer.d_override.conf.j2
Normal file
4
roles/base/templates/apt-daily.timer.d_override.conf.j2
Normal file
|
@ -0,0 +1,4 @@
|
|||
[Timer]
|
||||
OnCalendar=
|
||||
OnCalendar=02:00
|
||||
RandomizedDelaySec=0
|
100
roles/base/templates/automatic.conf.j2
Normal file
100
roles/base/templates/automatic.conf.j2
Normal file
|
@ -0,0 +1,100 @@
|
|||
[commands]
|
||||
# What kind of upgrade to perform:
|
||||
# default = all available upgrades
|
||||
# security = only the security upgrades
|
||||
upgrade_type = {{ base_redhat_dnf_automatic_upgrade_type }}
|
||||
random_sleep = {{ base_redhat_dnf_automatic_random_sleep }}
|
||||
|
||||
# To just receive updates use dnf-automatic-notifyonly.timer
|
||||
|
||||
# Whether updates should be downloaded when they are available, by
|
||||
# dnf-automatic.timer. notifyonly.timer, download.timer and
|
||||
# install.timer override this setting.
|
||||
download_updates = {{ base_redhat_dnf_automatic_download_updates }}
|
||||
|
||||
# Whether updates should be applied when they are available, by
|
||||
# dnf-automatic.timer. notifyonly.timer, download.timer and
|
||||
# install.timer override this setting.
|
||||
apply_updates = {{ base_redhat_dnf_automatic_apply_updates }}
|
||||
|
||||
|
||||
[emitters]
|
||||
# Name to use for this system in messages that are emitted. Default is the
|
||||
# hostname.
|
||||
{% if base_redhat_dnf_automatic_system_name != '' %}
|
||||
system_name = {{ base_redhat_dnf_automatic_system_name }}
|
||||
{% else %}
|
||||
# system_name = my-host
|
||||
{% endif %}
|
||||
|
||||
# How to send messages. Valid options are stdio, email and motd. If
|
||||
# emit_via includes stdio, messages will be sent to stdout; this is useful
|
||||
# to have cron send the messages. If emit_via includes email, this
|
||||
# program will send email itself according to the configured options.
|
||||
# If emit_via includes motd, /etc/motd file will have the messages. if
|
||||
# emit_via includes command_email, then messages will be send via a shell
|
||||
# command compatible with sendmail.
|
||||
# Default is email,stdio.
|
||||
# If emit_via is None or left blank, no messages will be sent.
|
||||
emit_via = {{ base_redhat_dnf_automatic_emit_via }}
|
||||
|
||||
|
||||
[email]
|
||||
# The address to send email messages from.
|
||||
email_from = {{ base_redhat_dnf_automatic_email_from }}
|
||||
|
||||
# List of addresses to send messages to.
|
||||
email_to = {{ base_redhat_dnf_automatic_email_to }}
|
||||
|
||||
# Name of the host to connect to to send email messages.
|
||||
email_host = {{ base_redhat_dnf_automatic_email_host }}
|
||||
|
||||
|
||||
[command]
|
||||
# The shell command to execute. This is a Python format string, as used in
|
||||
# str.format(). The format function will pass a shell-quoted argument called
|
||||
# `body`.
|
||||
{% if base_redhat_dnf_automatic_command_format != '' %}
|
||||
command_format = {{ base_redhat_dnf_automatic_command_format }}
|
||||
{% else %}
|
||||
# command_format = "cat"
|
||||
{% endif %}
|
||||
|
||||
# The contents of stdin to pass to the command. It is a format string with the
|
||||
# same arguments as `command_format`.
|
||||
{% if base_redhat_dnf_automatic_stdin_format != '' %}
|
||||
stdin_format = {{ base_redhat_dnf_automatic_stdin_format }}
|
||||
{% else %}
|
||||
# stdin_format = "{body}"
|
||||
{% endif %}
|
||||
|
||||
[command_email]
|
||||
# The shell command to use to send email. This is a Python format string,
|
||||
# as used in str.format(). The format function will pass shell-quoted arguments
|
||||
# called body, subject, email_from, email_to.
|
||||
{% if base_redhat_dnf_automatic_email_command_format != '' %}
|
||||
command_format = {{ base_redhat_dnf_automatic_email_command_format }}
|
||||
{% else %}
|
||||
# command_format = "mail -s {subject} -r {email_from} {email_to}"
|
||||
{% endif %}
|
||||
|
||||
# The contents of stdin to pass to the command. It is a format string with the
|
||||
# same arguments as `command_format`.
|
||||
{% if base_redhat_dnf_automatic_email_stdin_format != '' %}
|
||||
stdin_format = {{ base_redhat_dnf_automatic_email_stdin_format }}
|
||||
{% else %}
|
||||
# stdin_format = "{body}"
|
||||
{% endif %}
|
||||
|
||||
# The address to send email messages from.
|
||||
email_from = {{ base_redhat_dnf_automatic_email_from }}
|
||||
|
||||
# List of addresses to send messages to.
|
||||
email_to = {{ base_redhat_dnf_automatic_email_to }}
|
||||
|
||||
|
||||
[base]
|
||||
# This section overrides dnf.conf
|
||||
|
||||
# Use this to filter DNF core messages
|
||||
debuglevel = 1
|
2
roles/base/templates/dnf-automatic-install.service-7.j2
Normal file
2
roles/base/templates/dnf-automatic-install.service-7.j2
Normal file
|
@ -0,0 +1,2 @@
|
|||
[Service]
|
||||
ExecStartPost=/bin/sh -ec 'needs-restarting -r | grep -q "Reboot is req.*" && shutdown -r +5 Rebooting after applying package updates || exit 0'
|
2
roles/base/templates/dnf-automatic-install.service-8.j2
Normal file
2
roles/base/templates/dnf-automatic-install.service-8.j2
Normal file
|
@ -0,0 +1,2 @@
|
|||
[Service]
|
||||
ExecStartPost=/bin/sh -ec 'dnf needs-restarting -r | grep -q "Reboot is req.*" && shutdown -r +5 Rebooting after applying package updates || exit 0'
|
5
roles/base/templates/dnf-automatic-install.timer.j2
Normal file
5
roles/base/templates/dnf-automatic-install.timer.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
[Timer]
|
||||
OnBootSec=
|
||||
OnCalendar= 2:00
|
||||
RandomizedDelaySec=5m
|
||||
AccuracySec=1s
|
16
roles/base/templates/issue.j2
Normal file
16
roles/base/templates/issue.j2
Normal file
|
@ -0,0 +1,16 @@
|
|||
#jinja2: trim_blocks:False
|
||||
*********************************************************************
|
||||
* *
|
||||
* Unauthorized access to this machine is prohibited *
|
||||
* Disconnect if you are not an authorized user *
|
||||
* *
|
||||
* This system is for the use of authorized users only. Usage of *
|
||||
* this system may be monitored and recorded by system personnel. *
|
||||
* *
|
||||
* Anyone using this system expressly consents to such monitoring *
|
||||
* and is advised that if such monitoring reveals possible *
|
||||
* evidence of criminal activity, system personnel may provide the *
|
||||
* evidence from such monitoring to law enforcement officials. *
|
||||
* *
|
||||
*********************************************************************
|
||||
|
48
roles/base/templates/motd.j2
Normal file
48
roles/base/templates/motd.j2
Normal file
|
@ -0,0 +1,48 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Basic info
|
||||
HOSTNAME=`uname -n`
|
||||
OSVERSION=`hostnamectl | grep "Operating System" | sed 's/^.*: //'`
|
||||
CURRENTTIME=`date +"%Y-%m-%d %H:%M:%S"`
|
||||
UPTIMEP=`uptime -p`
|
||||
BOOTTIME=`uptime -s`
|
||||
CONNECTEDUSERS=`who | wc -l`
|
||||
|
||||
# System load
|
||||
MEMORY1=`free -t -m | grep Total | awk '{print $3" MB";}'`
|
||||
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'`
|
||||
MEMORY3=`free -t -m | grep Mem | awk '{print $3/$2 * 100.0}'`
|
||||
MEMORY4=`printf %.0f $MEMORY3`
|
||||
LOAD1=`cat /proc/loadavg | awk {'print $1'}`
|
||||
LOAD5=`cat /proc/loadavg | awk {'print $2'}`
|
||||
LOAD15=`cat /proc/loadavg | awk {'print $3'}`
|
||||
PROCESSES=`ps ax | wc -l | tr -d " "`
|
||||
SWAPSTAT=`free -m | tail -n 1 | awk '{print $3}'`
|
||||
USAGEROOT=`df -Ph | grep /$ | awk '{print $5 " of " $2}'`
|
||||
IPADDRESSES=`ip a|grep -oP "inet \K[0-9.]*(?=.*[^ ][^l][^o]$)"`
|
||||
|
||||
{% if base_core_motd_banner != '' %}
|
||||
BANNER='
|
||||
{{ base_core_motd_banner }}
|
||||
'
|
||||
|
||||
echo "$BANNER
|
||||
*********************************************************************
|
||||
{% else %}
|
||||
echo "*********************************************************************
|
||||
{% endif %}
|
||||
- Hostname............: $HOSTNAME
|
||||
- Operating System....: $OSVERSION
|
||||
- Uptime..............: $UPTIMEP
|
||||
- Current Time........: $CURRENTTIME
|
||||
- Boot Time...........: $BOOTTIME
|
||||
- Logged on users.....: $CONNECTEDUSERS
|
||||
*********************************************************************
|
||||
- Running Processes...: $PROCESSES
|
||||
- CPU usage...........: $LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min)
|
||||
- Memory usage........: $MEMORY1 / $MEMORY2 ($MEMORY4%)
|
||||
- Swap in use.........: $SWAPSTAT MB
|
||||
- Usage of /..........: $USAGEROOT
|
||||
- IP Addresses........: $IPADDRESSES
|
||||
*********************************************************************
|
||||
"
|
Loading…
Add table
Add a link
Reference in a new issue