Revisión c0cbb4bf
Añadido por root hace casi 9 años
ubuntu/trusty/all/linex-ubuntu-puppet/debian/changelog | ||
---|---|---|
linex-ubuntu-puppet (1.3) linex; urgency=medium
|
||
|
||
* Modificado escuela2.0 por ubuntu 16.04 (Eli).
|
||
* Añadida desactivación de servicio puppet para systemctl
|
||
* Cambiado script sinc_puppet por el de Esteban versión 1.8
|
||
|
||
-- Rafael J. García Perdigón <rafael.garciap@gobex.es> Mon, 04 Jul 2016 14:39:37 +0200
|
||
|
||
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/trusty/all/linex-ubuntu-puppet/debian/compat | ||
---|---|---|
8
|
ubuntu/trusty/all/linex-ubuntu-puppet/debian/conffiles | ||
---|---|---|
/usr/share/linex-ubuntu-puppet/escuela2.0
|
||
/usr/share/linex-ubuntu-puppet/puppet.conf
|
ubuntu/trusty/all/linex-ubuntu-puppet/debian/control | ||
---|---|---|
Source: linex-ubuntu-puppet
|
||
Section: admin
|
||
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/trusty/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/trusty/all/linex-ubuntu-puppet/debian/install | ||
---|---|---|
usr
|
ubuntu/trusty/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
|
||
/usr/share/linex-ubuntu-puppet/sinc_puppet /etc/network/if-up.d/sinc_puppet
|
||
/usr/share/linex-ubuntu-puppet/sincpuppet.default /etc/default/sincpuppet
|
||
|
ubuntu/trusty/all/linex-ubuntu-puppet/debian/postinst | ||
---|---|---|
#!/bin/bash
|
||
set -e
|
||
|
||
mkdir -p /etc/pkgsync
|
||
touch /etc/pkgsync/mayhave
|
||
touch /etc/pkgsync/maynothave
|
||
|
||
|
||
invoke-rc.d puppet stop
|
||
update-rc.d -f puppet remove
|
||
update-rc.d -f sincpuppet remove
|
||
|
||
|
||
rm -r /var/lib/puppet/ssl
|
||
|
||
puppet agent disable
|
||
[ -x /bin/systemctl ] && systemctl disable puppet.service
|
||
|
||
|
||
/usr/sbin/sinc_puppet &
|
||
exit 0
|
||
|
ubuntu/trusty/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/trusty/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/trusty/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/trusty/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/escuela2.0 | ||
---|---|---|
use=ubuntu
|
ubuntu/trusty/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/trusty/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/trusty/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sinc_puppet | ||
---|---|---|
#!/bin/bash
|
||
# Script para tratar de realizar la sincronización del cliente puppet
|
||
# Colocar en /etc/network/if-up.d/ para que se ejecute al levantar el interfaz de red
|
||
# Esteban M. Navas Martín
|
||
# Modificado: 15/02/2015
|
||
# Modificado: 19/05/2016
|
||
|
||
# Controlamos la ejecución manual o automática de sinc_puppet
|
||
ENABLE=yes
|
||
[ -r /etc/default/sincpuppet ] && . /etc/default/sincpuppet
|
||
if [ "$ENABLE" == "no" ] || [ ! "$ENABLE" ]; then
|
||
echo " * [info]: La aplicación 'sinc_puppet' está desactivada en /etc/default/sincpuppet."
|
||
echo " Para activarla poner el valor ENABLE=yes."
|
||
exit 0
|
||
fi
|
||
|
||
# Número máximo de segundos sin sincronizar con el servidor puppet
|
||
MAXTIME=`expr $INTERVAL \* 3600`
|
||
|
||
# Calculamos la diferencia
|
||
uno=$(stat -c %Y /var/log/syslog)
|
||
dos=$(stat -c %Y /var/lib/puppet/state/state.yaml)
|
||
dife=$((uno-dos))
|
||
|
||
# Aseguramos paquetes
|
||
dpkg --configure -a && apt-get -yf install && apt-get -y autoremove
|
||
|
||
echo "La última sincronización con PUPPET fue hace: "$(($dife / 3600)) "horas" | logger -s -t $0
|
||
echo "Intervalo de sincronización con PUPPET: $INTERVAL horas" | logger -s -t $0
|
||
echo
|
||
|
||
# Salimos si no se ha alcanzado el tiempo máximo sin sincronizar con PUPPET
|
||
if [ $dife -lt $MAXTIME ]; then exit 0; fi
|
||
|
||
ping -c 1 $PING_SERVER >/dev/null 2>&1
|
||
ERROR=$?
|
||
MAX=0
|
||
|
||
until [ $ERROR -eq "0" ] || [ $MAX -eq $PING_TRIES ]; do
|
||
echo "Falló Ping al servidor Puppet. Nuevo intento en $PING_INTERVAL segundos....." | logger -s -t $0
|
||
MAX=`expr $MAX + 1`
|
||
sleep $PING_INTERVAL
|
||
ping -c 1 $PING_SERVER >/dev/null 2>&1
|
||
ERROR=$?
|
||
done
|
||
|
||
if [ $MAX -eq $PING_TRIES ]; then
|
||
echo "Imposible contactar con el servidor....." | logger -s -t $0
|
||
exit 5
|
||
fi
|
||
|
||
# Activamos puppet, por si estuviera desactivado
|
||
puppet agent --enable
|
||
|
||
# Si no existe el certificado del cliente, ejecutamos puppet tratando de recibir un certificado
|
||
test -f /var/lib/puppet/ssl/certs/$(hostname -f).pem
|
||
if [ $? -eq "1" ]; then
|
||
puppet agent --test --waitforcert 60 >/dev/null 2>&1
|
||
exit 0
|
||
fi
|
||
|
||
#Si ha estado más de MAXTIME segundos sin sincronizar con puppet
|
||
if [ $dife -gt $MAXTIME ]; then
|
||
echo "Conexión con servidor de puppet. Esperando $SPLAYLIMIT para puppet....." | logger -s -t $0
|
||
puppet agent --onetime --no-daemonize --splay --splaylimit $SPLAYLIMIT
|
||
|
||
while [ $? -eq "1" ]; do
|
||
test -f /var/lib/puppet/state/puppetdlock && rm -f /var/lib/puppet/state/puppetdlock
|
||
rm -rf /var/lib/puppet/ssl/certs/$(hostname -f).pem
|
||
echo "FALLO Puppet. Nuevo intento en 30 segundos" | logger -s -t $0
|
||
puppet agent --test --waitforcert 60 >/dev/null 2>&1
|
||
done
|
||
fi
|
||
echo "Sistema PUPPET correcto" | logger -s -t $0
|
||
|
||
exit 0
|
ubuntu/trusty/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
|
ubuntu/trusty/all/linex-ubuntu-puppet/usr/share/linex-ubuntu-puppet/sincpuppet.default | ||
---|---|---|
# Defaults for sinc_puppet
|
||
#
|
||
|
||
# Activar o desactivar sinc_puppet:
|
||
# ENABLE="yes": activa sinc_puppet (opción por defecto)
|
||
# ENABLE="no" : desactiva sinc_puppet
|
||
# Si no existe la variable ENABLE o no tiene valor, es equivalente al valor 'yes'.
|
||
ENABLE="yes"
|
||
|
||
# Número máximo de horas sin sincronizar con el servidor puppet
|
||
INTERVAL="12" # horas
|
||
|
||
# Nombre DNS del servidor al que realizar ping para comprobar que estamos en el centro
|
||
PING_SERVER="puppetinstituto"
|
||
|
||
# Intervalo para volver a realizar ping en segundos
|
||
PING_INTERVAL="30" # segundos
|
||
|
||
# Número máximo de ping a realizar antes de dejar de intentar sincronizar con puppet
|
||
PING_TRIES="3"
|
||
|
||
# Definimos un tiempo máximo en minutos para retrasar la sincronización con el servidor
|
||
# El cliente se sincronizará de forma pseudoaleatoria dentro de este intervalo
|
||
# Básicamente sirve para evitar que muchas peticiones simultáneas de clientes saturen al servidor
|
||
# Este ajuste puede definirse en segundos (30 or 30s), minutos (30m), horas (6h),
|
||
# días (2d), o años (5y).
|
||
SPLAYLIMIT="3m"
|
||
|
Exportar a: Unified diff
linex-ubuntu-puppet:Trusty - Añadida la nueva versión