Revisión 947a4261
Añadido por root hace casi 9 años
ubuntu/xenial/all/linex-ubuntu-puppet/debian/changelog | ||
---|---|---|
linex-ubuntu-puppet (1.2) linex; urgency=medium
|
||
|
||
* Cambio del nombre del paquete de de linex-workstation-puppet a linex-ubuntu-puppet.
|
||
Cambiado el fichero escuela2.0.
|
||
Añadido el fichero de puppet.conf
|
||
Añadidos Divert a los ficheros de configuracion.
|
||
* Bloqueada la sincronización de plugins.
|
||
|
||
-- Rafael J. García Perdigón <rafael.garciap@gobex.es> Mon, 25 Jan 2016 12:15:40 +0100
|
||
|
||
linex-ubuntu-puppet (1.0) linex; urgency=low
|
||
|
||
* Initial Release. Metapackage to install puppet for linex workstations.
|
||
|
||
-- Rafael J. García Perdigón <rafael.garciap@gobex.es> Fri, 19 Sep 2014 10:10:03 +0200
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/compat | ||
---|---|---|
8
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/control | ||
---|---|---|
Source: linex-ubuntu-puppet
|
||
Section: x11
|
||
Priority: optional
|
||
Maintainer: Rafael Jesús García Perdigón <rafael.garciap@gobex.es>
|
||
Build-Depends: debhelper (>= 8.0.0)
|
||
Standards-Version: 3.9.4
|
||
|
||
Package: linex-ubuntu-puppet
|
||
Architecture: all
|
||
Depends: ${misc:Depends}, puppet, puppet-common, pkgsync
|
||
Description: Configuración del cliente puppet
|
||
Instalación de las dependencias del cliente de puppet,
|
||
junto con la configuración necesaria para dicho cliente
|
||
en el entorno de un centro educativo.
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/copyright | ||
---|---|---|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||
Upstream-Name: lingobex-desktop-theme
|
||
|
||
Files: *
|
||
Copyright: 2014 Gobierno de Extremadura
|
||
License: GPL-3.0+
|
||
|
||
Files: debian/*
|
||
Copyright: 2014 Gobierno de Extremadura
|
||
License: GPL-3.0+
|
||
|
||
License: GPL-3.0+
|
||
This program is free software: you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation, either version 3 of the License, or
|
||
(at your option) any later version.
|
||
.
|
||
This package is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
.
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
.
|
||
On Debian systems, the complete text of the GNU General
|
||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/install | ||
---|---|---|
usr
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/linex-ubuntu-puppet.links | ||
---|---|---|
/usr/share/linex-ubuntu-puppet/escuela2.0 /etc/escuela2.0
|
||
/usr/share/linex-ubuntu-puppet/puppet.conf /etc/puppet/puppet.conf
|
||
/usr/share/linex-ubuntu-puppet/leefichero.rb /usr/lib/ruby/vendor_ruby/facter/leefichero.rb
|
||
/usr/share/linex-ubuntu-puppet/sinc_puppet /usr/sbin/sinc_puppet
|
||
/usr/share/linex-ubuntu-puppet/sincpuppet /etc/init.d/sincpuppet
|
||
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/postinst | ||
---|---|---|
#!/bin/bash
|
||
set -e
|
||
|
||
update-rc.d sincpuppet defaults
|
||
invoke-rc.d sincpuppet start
|
||
|
||
mkdir -p /etc/pkgsync
|
||
touch /etc/pkgsync/mayhave
|
||
touch /etc/pkgsync/maynothave
|
||
|
||
invoke-rc.d puppet stop
|
||
update-rc.d -f puppet remove
|
||
|
||
exit 0
|
||
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/postrm | ||
---|---|---|
#!/bin/bash
|
||
|
||
set -e
|
||
|
||
PKG="linex-ubuntu-puppet"
|
||
SHAREDIR="/usr/share/linex-ubuntu-puppet"
|
||
|
||
remove_divert() {
|
||
diverter=$(dpkg-divert --listpackage $1)
|
||
if [ "$diverter" = "linex-ubuntu-puppet" ]; then
|
||
dpkg-divert --package linex-ubuntu-puppet --rename --remove $1
|
||
fi
|
||
}
|
||
|
||
|
||
if [ "$1" = remove ]; then
|
||
remove_divert /etc/puppet/puppet.conf
|
||
|
||
fi
|
||
|
||
if [ "$1" = purge ]; then
|
||
update-rc.d sincpuppet remove
|
||
fi
|
||
exit 0
|
||
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/preinst | ||
---|---|---|
#!/bin/bash
|
||
set -e
|
||
|
||
PKG="linex-ubuntu-puppet"
|
||
SHAREDIR="/usr/share/linex-ubuntu-puppet"
|
||
|
||
divert() {
|
||
diverted_file=$1
|
||
|
||
dpkg-divert --package "$PKG" --add --rename \
|
||
--divert "${diverted_file}-pre-$PKG" $diverted_file
|
||
}
|
||
|
||
divert /etc/puppet/puppet.conf
|
||
|
||
exit 0
|
||
|
ubuntu/xenial/all/linex-ubuntu-puppet/debian/rules | ||
---|---|---|
#!/usr/bin/make -f
|
||
# -*- makefile -*-
|
||
# Sample debian/rules that uses debhelper.
|
||
# This file was originally written by Joey Hess and Craig Small.
|
||
# As a special exception, when this file is copied by dh-make into a
|
||
# dh-make output file, you may use that output file without restriction.
|
||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||
|
||
# Uncomment this to turn on verbose mode.
|
||
#export DH_VERBOSE=1
|
||
|
||
%:
|
||
dh $@
|
ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/escuela2.0 | ||
---|---|---|
use=ubuntu
|
ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/leefichero.rb | ||
---|---|---|
# Archivo /usr/lib/ruby/vendor_ruby/facter/leefichero.rb
|
||
# Se utiliza para leer fichero /etc/escuela2.0 y anadir variables a facter
|
||
|
||
if File.exists?("/etc/escuela2.0")
|
||
File.open("/etc/escuela2.0").each do |line|
|
||
var = nil
|
||
value = nil
|
||
|
||
var = $1 and val = $2 if line =~ /^(.+)=(.+)$/
|
||
|
||
if var != nil && val != nil
|
||
Facter.add(var) do
|
||
setcode { val }
|
||
end
|
||
end
|
||
end
|
||
end
|
||
####
|
ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/puppet.conf | ||
---|---|---|
[main]
|
||
logdir=/var/log/puppet
|
||
vardir=/var/lib/puppet
|
||
ssldir=/var/lib/puppet/ssl
|
||
rundir=/var/run/puppet
|
||
factpath=$vardir/lib/facter
|
||
templatedir=$confdir/templates
|
||
prerun_command=/etc/puppet/etckeeper-commit-pre
|
||
postrun_command=/etc/puppet/etckeeper-commit-post
|
||
server=puppetinstituto
|
||
pluginsync=false
|
||
|
||
[master]
|
||
# These are needed when the puppetmaster is run by passenger
|
||
# and can safely be removed if webrick is used.
|
||
ssl_client_header = SSL_CLIENT_S_DN
|
||
ssl_client_verify_header = SSL_CLIENT_VERIFY
|
||
|
ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sinc_puppet | ||
---|---|---|
#!/bin/bash
|
||
#Modificado: 22/10/2015
|
||
|
||
uno=$(stat -c %Y /var/log/syslog)
|
||
dos=$(stat -c %Y /var/lib/puppet/state/state.yaml)
|
||
dife=$((uno-dos))
|
||
|
||
dpkg --configure -a && apt-get -yf install >/dev/null 2>&1
|
||
|
||
echo "La última sincronización con PUPPET fué hace: "$(($dife / 3600)) "horas" | logger -t $0
|
||
|
||
CUENTA=0
|
||
|
||
#ip link | grep "state UP"
|
||
GW=`ip route | grep default | cut -f3 -d" "`
|
||
ping -c 1 $GW >/dev/null 2>&1
|
||
until [ $? -eq "0" ]; do
|
||
if [ $CUENTA -lt 5 ]; then
|
||
echo "No se detecta ninguna interfaz de red levantada. Nuevo intento en 60 segundo ..." | logger -t $0
|
||
CUENTA=`expr $CUENTA + 1`
|
||
fi
|
||
sleep 60
|
||
#ip link | grep "state UP"
|
||
GW=`ip route | grep default | cut -f3 -d" "`
|
||
ping -c 1 $GW >/dev/null 2>&1
|
||
done
|
||
|
||
ping -c 1 servidor >/dev/null 2>&1
|
||
ERROR=$?
|
||
MAX=0
|
||
until [ $ERROR -eq "0" ] || [ $MAX -eq "5" ]; do
|
||
echo "Falló Ping al servidor Puppet. Nuevo intento en 30 segundos....." | logger -t $0
|
||
MAX=`expr $MAX + 1`
|
||
sleep 30
|
||
ping -c 1 servidor >/dev/null 2>&1
|
||
ERROR=$?
|
||
done
|
||
if [ $MAX -eq "5" ]; then
|
||
echo "Imposible contactar con el servidor..... exit 5" | logger -t $0
|
||
exit 5
|
||
fi
|
||
|
||
#Si ha estado más de 12 horas sin sincronizar con puppet
|
||
if [ $dife -gt 43200 ]; then
|
||
echo "Conexión con servidor de puppet. Esperando entre 0 y 5 minutos para puppet....." | logger -t $0
|
||
sleep $(($(od -dN2 /dev/urandom | sed -n 's/[^ ]* //p')%300))
|
||
#puppetd -t
|
||
puppet agent --enable
|
||
puppet agent --test >/dev/null 2>&1
|
||
while [ $? -eq "1" ]; do
|
||
rm -f /var/lib/puppet/state/puppetdlock
|
||
rm -rf /var/lib/puppet/ssl
|
||
echo "FALLO Puppet. Nuevo intento en 30 segundos" | logger -t $0
|
||
sleep 30
|
||
#puppetd -t
|
||
puppet agent --enable
|
||
puppet agent --test >/dev/null 2>&1
|
||
done
|
||
fi
|
||
echo "Sistema PUPPET correcto" | logger -t $0
|
||
|
ubuntu/xenial/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sincpuppet | ||
---|---|---|
#!/bin/bash
|
||
### BEGIN INIT INFO
|
||
# Provides: sincpuppet
|
||
# Required-Start: $local_fs $network
|
||
# Required-Stop:
|
||
# Default-Start: 2 3 4 5
|
||
# Default-Stop: 0 1 6
|
||
# Short-Description: Daemon to synchronize puppet
|
||
# Description: daemon to synchronize puppet.
|
||
### END INIT INFO
|
||
# When the machine has unavailable network, nslcd slow down everything trying to take ldap info.
|
||
# This daemon try to recognize that unavailability and stop nslcd daemon until network is available again.
|
||
|
||
SINCPUPPET_BIN=/usr/sbin/sinc_puppet
|
||
SINCPUPPET_DESC="Daemon to synchronize puppet"
|
||
|
||
[ -x "$SINCPUPPET_BIN" ] || exit 0
|
||
|
||
. /lib/lsb/init-functions
|
||
|
||
|
||
start() {
|
||
# set up state directory
|
||
|
||
log_daemon_msg "Starting $SINCPUPPET_DESC" "SincPuppet"
|
||
$SINCPUPPET_BIN &
|
||
log_end_msg $?
|
||
|
||
}
|
||
|
||
stop() {
|
||
log_daemon_msg "Stopping $SINCPUPPET_DESC" "SincPuppet"
|
||
killall sinc_puppet
|
||
log_end_msg $?
|
||
|
||
}
|
||
|
||
case "$1" in
|
||
start)
|
||
start
|
||
;;
|
||
stop)
|
||
stop
|
||
;;
|
||
*)
|
||
echo "Usage: $0 {start|stop|restart|status}"
|
||
exit 2
|
||
esac
|
||
|
||
|
||
exit 0
|
Exportar a: Unified diff
linex-ubuntu-puppet: Subidas las fuentes originales