From cba541af4a771d0792ee885fa89f481076cce00d Mon Sep 17 00:00:00 2001 From: Henrik Henriksson <hx@hx.ax> Date: Sun, 2 Dec 2018 00:49:07 +0100 Subject: [PATCH] Get to work --- .gitmodules | 12 +++ manifests/site.pp | 3 + modules/concat | 1 + modules/holger/files/puppetfetcher.sh | 22 ++++ modules/holger/manifests/init.pp | 5 + modules/holger/manifests/puppetfetch.pp | 14 +++ modules/lyslogclient/files/rsyslogd.conf | 125 +++++++++++++++++++++++ modules/lyslogclient/manifests/init.pp | 27 +++++ modules/nginx | 1 + modules/ntp | 1 + modules/stdlib | 1 + 11 files changed, 212 insertions(+) create mode 100644 .gitmodules create mode 100644 manifests/site.pp create mode 160000 modules/concat create mode 100644 modules/holger/files/puppetfetcher.sh create mode 100644 modules/holger/manifests/init.pp create mode 100644 modules/holger/manifests/puppetfetch.pp create mode 100644 modules/lyslogclient/files/rsyslogd.conf create mode 100644 modules/lyslogclient/manifests/init.pp create mode 160000 modules/nginx create mode 160000 modules/ntp create mode 160000 modules/stdlib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cbdefb8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "modules/stdlib"] + path = modules/stdlib + url = https://github.com/puppetlabs/puppetlabs-stdlib +[submodule "modules/ntp"] + path = modules/ntp + url = https://github.com/puppetlabs/puppetlabs-ntp +[submodule "modules/nginx"] + path = modules/nginx + url = https://github.com/voxpupuli/puppet-nginx.git +[submodule "modules/concat"] + path = modules/concat + url = https://github.com/puppetlabs/puppetlabs-concat diff --git a/manifests/site.pp b/manifests/site.pp new file mode 100644 index 0000000..5470d1d --- /dev/null +++ b/manifests/site.pp @@ -0,0 +1,3 @@ +node 'holgerspexet' { + include ::holger +} diff --git a/modules/concat b/modules/concat new file mode 160000 index 0000000..5ae070b --- /dev/null +++ b/modules/concat @@ -0,0 +1 @@ +Subproject commit 5ae070b67a0e49b4490f422771a5834e664091de diff --git a/modules/holger/files/puppetfetcher.sh b/modules/holger/files/puppetfetcher.sh new file mode 100644 index 0000000..e45e3ef --- /dev/null +++ b/modules/holger/files/puppetfetcher.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# This script fetches the puppet configuration for +# holgerspexet.lysator.liu.se from github and applies it +# +# Make sure to add the servers public key as a github deploy key + +export HOME=/root/ + +# Initialize repo if not already there +if [ ! -d /opt/holger-puppet ]; then + git clone --recursive git@github.com:holgerspexet/holger-puppet.git /opt/holger-puppet > /dev/null || exit 1 +fi + +# Update repo +cd /opt/holger-puppet || exit 1 +git pull > /dev/null || exit 1 +git submodule update --recursive --remote > /dev/null || exit 1 + +# Run puppet and hope all is well +puppet apply --modulepath=/opt/holger-puppet/modules/ /opt/holger-puppet/manifests/site.pp + + diff --git a/modules/holger/manifests/init.pp b/modules/holger/manifests/init.pp new file mode 100644 index 0000000..0ef6534 --- /dev/null +++ b/modules/holger/manifests/init.pp @@ -0,0 +1,5 @@ +class holger { + include ntp + include ::holger::puppetfetch + class { '::lyslogclient': } +} diff --git a/modules/holger/manifests/puppetfetch.pp b/modules/holger/manifests/puppetfetch.pp new file mode 100644 index 0000000..ece1ff4 --- /dev/null +++ b/modules/holger/manifests/puppetfetch.pp @@ -0,0 +1,14 @@ +class holger::puppetfetch { + file { '/opt/puppetfetcher.sh': + owner => 'root', + group => 'root', + mode => '744', + source => 'puppet:///modules/holger/puppetfetcher.sh', + } + cron { 'puppetfetcher': + ensure => present, + command => '/opt/puppetfetcher.sh', + user => root, + minute => 55, + } +} diff --git a/modules/lyslogclient/files/rsyslogd.conf b/modules/lyslogclient/files/rsyslogd.conf new file mode 100644 index 0000000..8750fdb --- /dev/null +++ b/modules/lyslogclient/files/rsyslogd.conf @@ -0,0 +1,125 @@ +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html +# +# Default logging rules can be found in /etc/rsyslog.d/50-default.conf +# These are currently not loaded + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +$ModLoad imklog # provides kernel logging support (previously done by rklogd) +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +mail.info -/var/log/mail.info +mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# +# Logging for INN news system. +# +news.crit /var/log/news/news.crit +news.err /var/log/news/news.err +news.notice -/var/log/news/news.notice + +# +# Some "catch-all" log files. +# +*.=debug;\ + auth,authpriv.none;\ + news.none;mail.none -/var/log/debug +*.=info;*.=notice;*.=warn;\ + auth,authpriv.none;\ + cron,daemon.none;\ + mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg * + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +# news.=crit;news.=err;news.=notice;\ +# *.=debug;*.=info;\ +# *.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ + news.err;\ + *.=debug;*.=info;\ + *.=notice;*.=warn |/dev/xconsole + +*.* @loghost.lysator.liu.se diff --git a/modules/lyslogclient/manifests/init.pp b/modules/lyslogclient/manifests/init.pp new file mode 100644 index 0000000..2f5957f --- /dev/null +++ b/modules/lyslogclient/manifests/init.pp @@ -0,0 +1,27 @@ +class lyslogclient +{ + file { + '/etc/rsyslog.conf': + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/lyslogclient/rsyslogd.conf'; + } + + service { + 'rsyslog': + ensure => 'running', + enable => true, + pattern => 'syslog', + subscribe => File['/etc/rsyslog.conf']; + } + + cron { + 'syslog_mark': + ensure => present, + command => '/usr/bin/logger mark', + user => root, + minute => 43, + } +} diff --git a/modules/nginx b/modules/nginx new file mode 160000 index 0000000..705c19b --- /dev/null +++ b/modules/nginx @@ -0,0 +1 @@ +Subproject commit 705c19b1b5c03e52416200c411a171d5009e61db diff --git a/modules/ntp b/modules/ntp new file mode 160000 index 0000000..572f4c1 --- /dev/null +++ b/modules/ntp @@ -0,0 +1 @@ +Subproject commit 572f4c10c42f06d59e8b67ab85845b327a7891e8 diff --git a/modules/stdlib b/modules/stdlib new file mode 160000 index 0000000..d1706fe --- /dev/null +++ b/modules/stdlib @@ -0,0 +1 @@ +Subproject commit d1706fef8802095b2f3520511326f9c2924a6b21 -- GitLab