Revisión 526
Añadido por Alfonso Pastor hace alrededor de 10 años
tareas_puppet/portatiles/alumno/portatiles2012_gconf/files/51_ies_fcodeorellana | ||
---|---|---|
/apps/nm-applet/disable-wifi-create true
|
tareas_puppet/portatiles/alumno/portatiles2012_gconf/LEEME | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Destino : Portatiles de alumno con la imagen nueva
|
||
|
||
Acción : Deshabilita de network-manager la opción de crear wifi
|
||
|
||
Notas : Configurar gconf, se pueden hacer un montón de cosas por aquí, quitar
|
||
salvapantallas, fondo de escritorio, etc, etc, pero yo lo que quería era
|
||
quitar la posibilidad de la creación de redes wifi, por aquí los
|
||
chavales ya empezaban a hacerlo, por esta razón lo he metido en
|
||
mandatory y no en defaults, para que no se pueda modificar. Se puede
|
||
también adaptar el fichero a vuestras necesidades, incluso se podrían
|
||
poner cosas en default en lugar de en mandatory, sólo habría que cambiar
|
||
el directorio de destino y quitar el parámetro --mandatory al
|
||
update-gconf-defaults
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
Creado por:
|
||
|
||
Francisco Paniagua Sánchez
|
||
Administrador Informático del IES Francisco de Orellana (Trujillo).
|
||
24-Octubre-2012
|
||
tareas_puppet/portatiles/alumno/portatiles2012_gconf/manifests/init.pp | ||
---|---|---|
class portatiles2012_gconf {
|
||
|
||
file {"/usr/share/gconf/mandatory/51_ies_fcodeorellana":
|
||
owner => root, group => root, mode => 644,
|
||
source => "puppet:///portatiles2012_gconf/51_ies_fcodeorellana",
|
||
notify => Exec["actualizar-gconf-orellana"],
|
||
}
|
||
exec { "actualizar-gconf-orellana":
|
||
command => "/usr/bin/update-gconf-defaults --mandatory",
|
||
subscribe => File["/usr/share/gconf/mandatory/51_ies_fcodeorellana"],
|
||
require => File["/usr/share/gconf/mandatory/51_ies_fcodeorellana"],
|
||
refreshonly => true
|
||
}
|
||
|
||
}
|
||
|
tareas_puppet/portatiles/comunes/port_ramzswap/manifests/init.pp | ||
---|---|---|
class port_ramzswap {
|
||
|
||
file { "/root/ramzswap" :
|
||
owner=>root, group=>root, mode=>644,
|
||
ensure => directory,
|
||
}
|
||
|
||
file { "/etc/init.d/ramzswap.sh" :
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_ramzswap/ramzswap/ramzswap.sh",
|
||
notify=> Exec ["crea-enlaces-ramzswap"],
|
||
}
|
||
|
||
file { "/root/ramzswap/desactiva.sh" :
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_ramzswap/ramzswap/desactiva.sh",
|
||
require => File ["/root/ramzswap","/etc/init.d/ramzswap.sh"],
|
||
}
|
||
|
||
file { "/root/ramzswap/inicializa.sh" :
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_ramzswap/ramzswap/inicializa.sh",
|
||
require => File ["/root/ramzswap","/etc/init.d/ramzswap.sh"],
|
||
notify => Exec ["crea-enlaces-ramzswap"],
|
||
}
|
||
|
||
exec { "crea-enlaces-ramzswap" :
|
||
path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||
command => "update-rc.d ramzswap.sh defaults",
|
||
require => File ["/etc/init.d/ramzswap.sh"],
|
||
unless => "ls /etc/rc2.d/S??ramzswap.sh",
|
||
}
|
||
|
||
}
|
tareas_puppet/portatiles/comunes/port_ramzswap/files/ramzswap/desactiva.sh | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: desactiva.sh
|
||
# Required-Start:
|
||
# Required-Stop:
|
||
# Default-Start:
|
||
# Default-Stop: 0,1,6
|
||
# Short-Description: desactiva la ramzswap
|
||
### END INIT INFO
|
||
|
||
for device in $(grep -E --only-matching '/dev/zram[[:digit:]]+' /proc/swaps); do
|
||
swapoff "$device"
|
||
done
|
||
# remove module, wait instead of failing if it's busy
|
||
rmmod --wait zram
|
||
tareas_puppet/portatiles/comunes/port_ramzswap/files/ramzswap/ramzswap.sh | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: ramzswap.sh
|
||
# Required-Start: $remote_fs $syslog $all
|
||
# Required-Stop:
|
||
# Default-Start: 2 3 4 5
|
||
# Default-Stop: 0 1 6
|
||
# Short-Description: inicializa la ramzswap
|
||
### END INIT INFO
|
||
|
||
|
||
set -e
|
||
|
||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||
|
||
. /lib/init/swap-functions.sh
|
||
|
||
case "$1" in
|
||
|
||
start|"")
|
||
# Activa ramz
|
||
/root/ramzswap/inicializa.sh
|
||
;;
|
||
restart|reload|force-reload)
|
||
echo "Error: argument '$1' not supported" >&2
|
||
exit 3
|
||
;;
|
||
stop)
|
||
# Desactiva ramz
|
||
/root/ramzswap/desactiva.sh
|
||
;;
|
||
*)
|
||
echo "Usage: ramzwap.sh [start|stop]" >&2
|
||
exit 3
|
||
;;
|
||
esac
|
||
|
||
exit 0
|
||
|
||
tareas_puppet/portatiles/comunes/port_ramzswap/files/ramzswap/inicializa.sh | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: inicializa.sh
|
||
# Required-Start:
|
||
# Required-Stop:
|
||
# Default-Start: 2 3 4 5
|
||
# Default-Stop: 0 1 6
|
||
# Short-Description: inicializa la ramzswap
|
||
### END INIT INFO
|
||
|
||
|
||
get_number_of_present_cpus() {
|
||
cpulist=$( cat /sys/devices/system/cpu/present | tr ',' ' ' )
|
||
local num_cpus=0
|
||
for item in $cpulist; do
|
||
if ( echo $item | grep --silent '-' ); then
|
||
greater_cpunum=$( echo $item | cut -d '-' -f 2 )
|
||
lesser_cpunum=$( echo $item | cut -d '-' -f 1 )
|
||
local num_cpus=$(( $num_cpus + $greater_cpunum - $lesser_cpunum + 1 ))
|
||
else
|
||
local num_cpus=$(( $num_cpus + 1 ))
|
||
fi
|
||
done
|
||
echo $num_cpus
|
||
}
|
||
|
||
# get the number of CPUs
|
||
num_cpus=$(get_number_of_present_cpus)
|
||
|
||
# set decremented number of CPUs
|
||
decr_num_cpus=$((num_cpus - 1))
|
||
|
||
# get the amount of memory in the machine
|
||
mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching '[[:digit:]]+')
|
||
mem_total=$((mem_total_kb * 1024))
|
||
|
||
# determine modprobe parameter name, depending on kernel version
|
||
if (uname --release | grep -E --silent "^3\.[123]"); then
|
||
num_devices_parameter='zram_num_devices'
|
||
else
|
||
num_devices_parameter='num_devices'
|
||
fi
|
||
|
||
# load zram modules
|
||
modprobe zram $num_devices_parameter=$num_cpus
|
||
|
||
# initialize the devices, set total size to 1/2 RAM
|
||
for i in $(seq 0 $decr_num_cpus); do
|
||
echo $((mem_total / 2 / num_cpus)) > /sys/block/zram$i/disksize
|
||
done
|
||
|
||
# Creating swap filesystems
|
||
for i in $(seq 0 $decr_num_cpus); do
|
||
mkswap /dev/zram$i
|
||
done
|
||
|
||
# Switch the swaps on
|
||
for i in $(seq 0 $decr_num_cpus); do
|
||
swapon -p 100 /dev/zram$i
|
||
done
|
||
tareas_puppet/portatiles/comunes/port_ramzswap/leeme.txt | ||
---|---|---|
Configura los portátiles con la swap tirando de memoria RAM antes que la swap de disco.
|
||
Esto hace que todos los procesos de I/O sean mucho más rápidos.
|
||
|
||
Se intenta gestionar más eficientemente el uso de la swap.
|
||
|
||
Por defecto la configuración de ramzswap es la siguiente:
|
||
|
||
memoria_total /2 / num_cpus (para equipos con 1 Gb y 2 cpus 2 swap de ram de 256 Mb).
|
||
|
||
Autor: Oscar Vaquero (Administración SI)
|
||
|
||
|
||
Modificación de los scripts para adaptarlos a cualquier sistema,
|
||
creación de tarea puppet y pruebas.
|
||
|
||
|
||
Francisco Rodrigo López
|
||
IES Javier García Téllez (Caceres).
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules.
|
||
Incluirlo en especifica-miniportatil-2011.pp
|
tareas_puppet/portatiles/comunes/cambia-root.pp | ||
---|---|---|
# Descripcion: Cambia el password de root
|
||
# Instrucciones: Abrir el fichero /etc/shadow de nuestro equipo, copiar el password de nuestro usuario y pegarlo donde pone 'Aqui_el_password'.
|
||
#
|
||
# Manuel Mora Gordillo <manuel.mora.gordillo @no-spam@ gmail.com>
|
||
# IES Sta Eulalia - Merida
|
||
|
||
class cambia-root {
|
||
user{ root:
|
||
password => 'Aqui_el_password',
|
||
ensure => present
|
||
}
|
||
}
|
||
|
||
|
tareas_puppet/portatiles/comunes/portatiles2012_menuelectricidad/LEEME | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Destino : Portatiles con la imagen nueva
|
||
|
||
Acción : Eliminar el menú electricidad del menú principal
|
||
|
||
Notas :
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
Creado por:
|
||
|
||
Francisco Paniagua Sánchez
|
||
Administrador Informático del IES Francisco de Orellana (Trujillo).
|
||
24-Octubre-2012
|
||
tareas_puppet/portatiles/comunes/portatiles2012_menuelectricidad/manifests/init.pp | ||
---|---|---|
class portatiles2012_menuelectricidad {
|
||
|
||
exec {"borrar-menu-electricidad":
|
||
|
||
command => "/bin/rm -f /usr/share/extra-xdg-menus/electronics.menu",
|
||
onlyif => "/bin/ls /usr/share/extra-xdg-menus/electronics.menu",
|
||
|
||
}
|
||
|
||
|
||
}
|
tareas_puppet/portatiles/comunes/portatiles2012_iceweasel/files/iceweasel.cfg | ||
---|---|---|
//Pagina de inicio
|
||
pref("browser.startup.homepage","http://www.google.es");
|
||
|
||
//Transferencia
|
||
lockPref("network.http.pipelining",true);
|
||
lockPref("network.http.proxy.pipelining",true);
|
||
lockPref("network.http.pipelining.maxrequest",8);
|
||
|
||
//Proxy
|
||
lockPref("network.proxy.type",0);
|
||
|
||
//ipv6
|
||
lockPref("network.dns.disableIPv6",true);
|
||
|
||
//cache
|
||
lockPref("browser.cache.disk.smart_size.enabled",false);
|
||
lockPref("browser.cache.disk.capacity",50000);
|
||
|
tareas_puppet/portatiles/comunes/portatiles2012_iceweasel/files/iceweasel.js | ||
---|---|---|
// This is the Debian specific preferences file for Iceweasel
|
||
// You can make any change in here, it is the purpose of this file.
|
||
// You can, with this file and all files present in the
|
||
// /etc/iceweasel/pref directory, override any preference that is
|
||
// present in /usr/lib/iceweasel/defaults/preferences directory.
|
||
// While your changes will be kept on upgrade if you modify files in
|
||
// /etc/iceweasel/pref, please note that they won't be kept if you
|
||
// do make your changes in /usr/lib/iceweasel/defaults/preferences.
|
||
//
|
||
// Note that lockPref is allowed in these preferences files if you
|
||
// don't want users to be able to override some preferences.
|
||
|
||
pref("extensions.update.enabled", true);
|
||
|
||
// Use LANG environment variable to choose locale
|
||
pref("intl.locale.matchOS", true);
|
||
|
||
// Disable default browser checking.
|
||
pref("browser.shell.checkDefaultBrowser", false);
|
||
|
||
//pref("browser.startup.homepage","http://www.google.es");
|
||
|
||
pref("general.config.obscure_value", 0);
|
||
pref("general.config.filename", "iceweasel.cfg");
|
tareas_puppet/portatiles/comunes/portatiles2012_iceweasel/LEEME | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Destino : Portatiles con la imagen nueva
|
||
|
||
Acción : Personaliza iceweasel
|
||
|
||
Notas : Personalizar la configuración de iceweasel, sobre todo por el tema de
|
||
la página de inicio. Se puede adaptar a vuestras necesidades tocando el
|
||
fichero iceweasel.cfg (yo he puesto las mías).
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
Creado por:
|
||
|
||
Francisco Paniagua Sánchez
|
||
Administrador Informático del IES Francisco de Orellana (Trujillo).
|
||
24-Octubre-2012
|
||
tareas_puppet/portatiles/comunes/portatiles2012_iceweasel/manifests/init.pp | ||
---|---|---|
class portatiles2012_iceweasel {
|
||
|
||
file {"/etc/iceweasel/pref/iceweasel.js":
|
||
owner => root, group => root, mode => 644,
|
||
source => "puppet:///portatiles2012_iceweasel/iceweasel.js"
|
||
}
|
||
|
||
file {"/usr/lib/iceweasel/iceweasel.cfg":
|
||
owner => root, group => root, mode => 644,
|
||
source => "puppet:///portatiles2012_iceweasel/iceweasel.cfg"
|
||
}
|
||
|
||
}
|
tareas_puppet/portatiles/comunes/wifi_mac/leeme.txt | ||
---|---|---|
wifi_mac
|
||
|
||
* Tarea de puppet:
|
||
- Añade el fichero "wifi_mac" al directorio "/etc/network/if-pre-up.d/"
|
||
|
||
* wifi_mac:
|
||
- Hace que la interfaz wifi (wlan0) use la misma MAC que tiene la interfaz ethernet (eth0)
|
||
- De esta forma, basta con tener dado de alta a los portátiles de profesores una sola vez en LDAP, para que puedan acceder a sus carpetas personales del servidor NFS.
|
||
|
||
|
||
Antonio J. Abasolo Sierra
|
||
IES Rodriguez Moñino
|
||
Diciembre-2012
|
||
|
||
|
||
tareas_puppet/portatiles/comunes/wifi_mac/changelog | ||
---|---|---|
10/12/12 Release incial
|
||
tareas_puppet/portatiles/comunes/wifi_mac/manifests/init.pp | ||
---|---|---|
class wifi_mac {
|
||
file {
|
||
"/etc/network/if-pre-up.d/wifi_mac":
|
||
owner => root, group => root, mode => 755,
|
||
source => "puppet:///modules/wifi_mac/wifi_mac",
|
||
}
|
||
}
|
||
|
||
tareas_puppet/portatiles/comunes/wifi_mac/files/wifi_mac | ||
---|---|---|
#!/bin/bash
|
||
# Antonio J. Abasolo Sierra (Dic-2012)
|
||
# Asocia la mac wifi con la mac eth0, para que se conecte siempre con la misma MAC
|
||
# Util para los portátiles de profesores, para no tener que darlos de alta 2 veces en LDAP
|
||
# Se debe colocar el script en la ruta: /etc/network/if-pre-up.d/
|
||
#. -------------------------------------------------------------------------------------------
|
||
|
||
RED_ETH=eth0
|
||
RED_WIFI=wlan0
|
||
FILE_RULES=/etc/udev/rules.d/70-persistent-net.rules
|
||
|
||
MAC_ETH=`ifconfig $RED_ETH | grep HW | awk '{print $5}'`
|
||
MAC_WIFI=`ifconfig $RED_WIFI | grep HW | awk '{print $5}'`
|
||
|
||
if [ -z $MAC_WIFI]; then
|
||
MAC_WIFI=`cat $FILE_RULES | grep $RED_WIFI | cut -f4 -d, | cut -f2 -d'"'`
|
||
fi
|
||
|
||
ifconfig $RED_WIFI down
|
||
ifconfig $RED_WIFI hw ether $MAC_ETH
|
||
ifconfig $RED_WIFI up
|
||
|
||
tareas_puppet/portatiles/comunes/wifi_mac/files/wifi_mac2 | ||
---|---|---|
#!/bin/bash
|
||
# Antonio J. Abasolo Sierra (Dic-2012)
|
||
# Asocia la mac wifi con la mac eth0, para que se conecte siempre con la misma MAC
|
||
# Util para los portátiles de profesores, para no tener que darlos de alta 2 veces en LDAP
|
||
# Se debe colocar el script en la ruta: /etc/network/if-pre-up.d/
|
||
#. -------------------------------------------------------------------------------------------
|
||
|
||
RED_ETH=eth0
|
||
RED_WIFI=wlan0
|
||
FILE_RULES=/etc/udev/rules.d/70-persistent-net.rules
|
||
|
||
MAC_ETH=`cat $FILE_RULES | grep $RED_ETH | cut -f4 -d, | cut -f2 -d'"'`
|
||
MAC_WIFI=`cat $FILE_RULES | grep $RED_WIFI | cut -f4 -d, | cut -f2 -d'"'`
|
||
|
||
ifconfig $RED_WIFI down
|
||
ifconfig $RED_WIFI hw ether $MAC_ETH
|
||
ifconfig $RED_WIFI up
|
||
|
||
tareas_puppet/portatiles/comunes/portatiles2012_puppetconf/LEEME | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Destino : Portatiles de alumno con la imagen nueva
|
||
|
||
Acción : Eliminar el warning que da puppet al ejecutarse
|
||
|
||
Notas : Cambia el fichero de configuración (sustituye puppetmasterd por master)
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
Creado por:
|
||
|
||
Francisco Paniagua Sánchez
|
||
Administrador Informático del IES Francisco de Orellana (Trujillo).
|
||
24-Octubre-2012
|
||
tareas_puppet/portatiles/comunes/portatiles2012_puppetconf/manifests/init.pp | ||
---|---|---|
class portatiles2012_puppetconf {
|
||
|
||
file {"/etc/puppet/puppet.conf":
|
||
owner => root, group => root, mode => 644,
|
||
source => "puppet:///portatiles2012_puppetconf/puppet.conf",
|
||
|
||
}
|
||
|
||
}
|
||
|
tareas_puppet/portatiles/comunes/portatiles2012_puppetconf/files/puppet.conf | ||
---|---|---|
[main]
|
||
logdir=/var/log/puppet
|
||
vardir=/var/lib/puppet
|
||
ssldir=/var/lib/puppet/ssl
|
||
rundir=/var/run/puppet
|
||
factpath=$vardir/lib/facter
|
||
#pluginsync=true
|
||
server=puppetinstituto
|
||
runinterval=5400
|
||
syslogfacility=
|
||
report=true
|
||
|
||
[master]
|
||
templatedir=/var/lib/puppet/templates
|
||
|
tareas_puppet/portatiles/comunes/port_actualiza-anacron/files/anacron | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: anacron
|
||
# Required-Start: $remote_fs $syslog $time
|
||
# Required-Stop: $remote_fs $syslog $time
|
||
# Default-Start: 2 3 4 5
|
||
# Default-Stop: 0 1 6
|
||
# Short-Description: Handle anac(h)ronistic cron
|
||
### END INIT INFO
|
||
# /etc/init.d/anacron: start anacron
|
||
#
|
||
|
||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||
|
||
test -x /usr/sbin/anacron || exit 0
|
||
|
||
. /lib/lsb/init-functions
|
||
|
||
case "$1" in
|
||
start)
|
||
log_daemon_msg "Starting anac(h)ronistic cron" "anacron"
|
||
if test -x /usr/bin/on_ac_power
|
||
then
|
||
/usr/bin/on_ac_power >/dev/null
|
||
if test $? -eq 1
|
||
then
|
||
bateria_restante=`acpi | tr -d " " | cut -f2 -d"," | cut -f1 -d"%"`
|
||
if [ $bateria_restante -lt 80 ];
|
||
then
|
||
log_progress_msg "deferred while on battery power."
|
||
log_end_msg 0
|
||
exit 0
|
||
fi
|
||
fi
|
||
fi
|
||
|
||
# on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used)
|
||
# or on_ac_power returns 255 (undefined, desktop machine without APM)
|
||
start-stop-daemon --start --exec /usr/sbin/anacron -- -s
|
||
log_end_msg 0
|
||
;;
|
||
restart|force-reload|reload)
|
||
# nothing to do
|
||
:
|
||
;;
|
||
stop)
|
||
log_daemon_msg "Stopping anac(h)ronistic cron" "anacron"
|
||
start-stop-daemon --stop --exec /usr/sbin/anacron --oknodo --quiet
|
||
log_end_msg 0
|
||
;;
|
||
status)
|
||
exit 4
|
||
;;
|
||
*)
|
||
echo "Usage: /etc/init.d/anacron {start|stop|restart|force-reload|reload}"
|
||
exit 2
|
||
;;
|
||
esac
|
||
|
||
exit 0
|
||
tareas_puppet/portatiles/comunes/port_actualiza-anacron/leeme.txt | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Este modulo modifica el script /etc/init.d/anacron en los portátiles tanto de profes como de alumnos.
|
||
La modificación consiste en que se comprueba el nivel de batería del portátil.
|
||
|
||
Si es menor que el 80% no se ejecuta el anacron y por consiguiente todas las tareas
|
||
asociadas en los directorios /etc/cron.daily /etc/cron.weekly y /etc/cron.monthly no se ejecutan.
|
||
|
||
Sin embargo si la carga de batería es superior al 80% sí se ejecutarán las tareas, como por ejemplo pkgsync.
|
||
|
||
Se ejecutará una vez y hasta el siguiente reinicio no se hará efectivo.
|
||
|
||
La tarea comprueba la batería al iniciarse el servicio, lo que no significa que las tareas se ejecuten inmediatamente, si no a la hora que le corresponda.
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
22-Marzo-2013.
|
||
Francisco Rodrigo Lopez
|
||
Administrador informatico del IES JAVIER GARCIA TELLEZ
|
||
tareas_puppet/portatiles/comunes/port_actualiza-anacron/manifests/init.pp | ||
---|---|---|
class port_actualiza-anacron {
|
||
|
||
file { "/etc/init.d/anacron":
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_actualiza-anacron/anacron",
|
||
}
|
||
|
||
file {"/usr/lib/pm-utils/power.d/anacron":
|
||
ensure => absent
|
||
}
|
||
|
||
}
|
tareas_puppet/portatiles/squeeze/comunes/wifi_mac/changelog | ||
---|---|---|
10/12/12 Release incial
|
||
tareas_puppet/portatiles/squeeze/comunes/wifi_mac/manifests/init.pp | ||
---|---|---|
class wifi_mac {
|
||
file {
|
||
"/etc/network/if-pre-up.d/wifi_mac":
|
||
owner => root, group => root, mode => 755,
|
||
source => "puppet:///modules/wifi_mac/wifi_mac",
|
||
}
|
||
}
|
||
|
||
tareas_puppet/portatiles/squeeze/comunes/wifi_mac/files/wifi_mac | ||
---|---|---|
#!/bin/bash
|
||
# Antonio J. Abasolo Sierra (Dic-2012)
|
||
# Asocia la mac wifi con la mac eth0, para que se conecte siempre con la misma MAC
|
||
# Util para los portátiles de profesores, para no tener que darlos de alta 2 veces en LDAP
|
||
# Se debe colocar el script en la ruta: /etc/network/if-pre-up.d/
|
||
#. -------------------------------------------------------------------------------------------
|
||
|
||
RED_ETH=eth0
|
||
RED_WIFI=wlan0
|
||
FILE_RULES=/etc/udev/rules.d/70-persistent-net.rules
|
||
|
||
MAC_ETH=`ifconfig $RED_ETH | grep HW | awk '{print $5}'`
|
||
MAC_WIFI=`ifconfig $RED_WIFI | grep HW | awk '{print $5}'`
|
||
|
||
if [ -z $MAC_WIFI]; then
|
||
MAC_WIFI=`cat $FILE_RULES | grep $RED_WIFI | cut -f4 -d, | cut -f2 -d'"'`
|
||
fi
|
||
|
||
ifconfig $RED_WIFI down
|
||
ifconfig $RED_WIFI hw ether $MAC_ETH
|
||
ifconfig $RED_WIFI up
|
||
|
||
tareas_puppet/portatiles/squeeze/comunes/wifi_mac/files/wifi_mac2 | ||
---|---|---|
#!/bin/bash
|
||
# Antonio J. Abasolo Sierra (Dic-2012)
|
||
# Asocia la mac wifi con la mac eth0, para que se conecte siempre con la misma MAC
|
||
# Util para los portátiles de profesores, para no tener que darlos de alta 2 veces en LDAP
|
||
# Se debe colocar el script en la ruta: /etc/network/if-pre-up.d/
|
||
#. -------------------------------------------------------------------------------------------
|
||
|
||
RED_ETH=eth0
|
||
RED_WIFI=wlan0
|
||
FILE_RULES=/etc/udev/rules.d/70-persistent-net.rules
|
||
|
||
MAC_ETH=`cat $FILE_RULES | grep $RED_ETH | cut -f4 -d, | cut -f2 -d'"'`
|
||
MAC_WIFI=`cat $FILE_RULES | grep $RED_WIFI | cut -f4 -d, | cut -f2 -d'"'`
|
||
|
||
ifconfig $RED_WIFI down
|
||
ifconfig $RED_WIFI hw ether $MAC_ETH
|
||
ifconfig $RED_WIFI up
|
||
|
||
tareas_puppet/portatiles/squeeze/comunes/wifi_mac/leeme.txt | ||
---|---|---|
wifi_mac
|
||
|
||
* Tarea de puppet:
|
||
- Añade el fichero "wifi_mac" al directorio "/etc/network/if-pre-up.d/"
|
||
|
||
* wifi_mac:
|
||
- Hace que la interfaz wifi (wlan0) use la misma MAC que tiene la interfaz ethernet (eth0)
|
||
- De esta forma, basta con tener dado de alta a los portátiles de profesores una sola vez en LDAP, para que puedan acceder a sus carpetas personales del servidor NFS.
|
||
|
||
|
||
Antonio J. Abasolo Sierra
|
||
IES Rodriguez Moñino
|
||
Diciembre-2012
|
||
|
||
|
||
tareas_puppet/portatiles/squeeze/comunes/port_actualiza-anacron/manifests/init.pp | ||
---|---|---|
class port_actualiza-anacron {
|
||
|
||
file { "/etc/init.d/anacron":
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_actualiza-anacron/anacron",
|
||
}
|
||
|
||
file {"/usr/lib/pm-utils/power.d/anacron":
|
||
ensure => absent
|
||
}
|
||
|
||
}
|
tareas_puppet/portatiles/squeeze/comunes/port_actualiza-anacron/leeme.txt | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Este modulo modifica el script /etc/init.d/anacron en los portátiles tanto de profes como de alumnos.
|
||
La modificación consiste en que se comprueba el nivel de batería del portátil.
|
||
|
||
Si es menor que el 80% no se ejecuta el anacron y por consiguiente todas las tareas
|
||
asociadas en los directorios /etc/cron.daily /etc/cron.weekly y /etc/cron.monthly no se ejecutan.
|
||
|
||
Sin embargo si la carga de batería es superior al 80% sí se ejecutarán las tareas, como por ejemplo pkgsync.
|
||
|
||
Se ejecutará una vez y hasta el siguiente reinicio no se hará efectivo.
|
||
|
||
La tarea comprueba la batería al iniciarse el servicio, lo que no significa que las tareas se ejecuten inmediatamente, si no a la hora que le corresponda.
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
22-Marzo-2013.
|
||
Francisco Rodrigo Lopez
|
||
Administrador informatico del IES JAVIER GARCIA TELLEZ
|
||
tareas_puppet/portatiles/squeeze/comunes/port_actualiza-anacron/files/anacron | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: anacron
|
||
# Required-Start: $remote_fs $syslog $time
|
||
# Required-Stop: $remote_fs $syslog $time
|
||
# Default-Start: 2 3 4 5
|
||
# Default-Stop: 0 1 6
|
||
# Short-Description: Handle anac(h)ronistic cron
|
||
### END INIT INFO
|
||
# /etc/init.d/anacron: start anacron
|
||
#
|
||
|
||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||
|
||
test -x /usr/sbin/anacron || exit 0
|
||
|
||
. /lib/lsb/init-functions
|
||
|
||
case "$1" in
|
||
start)
|
||
log_daemon_msg "Starting anac(h)ronistic cron" "anacron"
|
||
if test -x /usr/bin/on_ac_power
|
||
then
|
||
/usr/bin/on_ac_power >/dev/null
|
||
if test $? -eq 1
|
||
then
|
||
bateria_restante=`acpi | tr -d " " | cut -f2 -d"," | cut -f1 -d"%"`
|
||
if [ $bateria_restante -lt 80 ];
|
||
then
|
||
log_progress_msg "deferred while on battery power."
|
||
log_end_msg 0
|
||
exit 0
|
||
fi
|
||
fi
|
||
fi
|
||
|
||
# on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used)
|
||
# or on_ac_power returns 255 (undefined, desktop machine without APM)
|
||
start-stop-daemon --start --exec /usr/sbin/anacron -- -s
|
||
log_end_msg 0
|
||
;;
|
||
restart|force-reload|reload)
|
||
# nothing to do
|
||
:
|
||
;;
|
||
stop)
|
||
log_daemon_msg "Stopping anac(h)ronistic cron" "anacron"
|
||
start-stop-daemon --stop --exec /usr/sbin/anacron --oknodo --quiet
|
||
log_end_msg 0
|
||
;;
|
||
status)
|
||
exit 4
|
||
;;
|
||
*)
|
||
echo "Usage: /etc/init.d/anacron {start|stop|restart|force-reload|reload}"
|
||
exit 2
|
||
;;
|
||
esac
|
||
|
||
exit 0
|
||
tareas_puppet/portatiles/squeeze/comunes/port_ramzswap/manifests/init.pp | ||
---|---|---|
class port_ramzswap {
|
||
|
||
file { "/root/ramzswap" :
|
||
owner=>root, group=>root, mode=>644,
|
||
ensure => directory,
|
||
}
|
||
|
||
file { "/etc/init.d/ramzswap.sh" :
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_ramzswap/ramzswap/ramzswap.sh",
|
||
notify=> Exec ["crea-enlaces-ramzswap"],
|
||
}
|
||
|
||
file { "/root/ramzswap/desactiva.sh" :
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_ramzswap/ramzswap/desactiva.sh",
|
||
require => File ["/root/ramzswap","/etc/init.d/ramzswap.sh"],
|
||
}
|
||
|
||
file { "/root/ramzswap/inicializa.sh" :
|
||
owner=>root, group=>root, mode=>755,
|
||
source=>"puppet:///modules/port_ramzswap/ramzswap/inicializa.sh",
|
||
require => File ["/root/ramzswap","/etc/init.d/ramzswap.sh"],
|
||
notify => Exec ["crea-enlaces-ramzswap"],
|
||
}
|
||
|
||
exec { "crea-enlaces-ramzswap" :
|
||
path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||
command => "update-rc.d ramzswap.sh defaults",
|
||
require => File ["/etc/init.d/ramzswap.sh"],
|
||
unless => "ls /etc/rc2.d/S??ramzswap.sh",
|
||
}
|
||
|
||
}
|
tareas_puppet/portatiles/squeeze/comunes/port_ramzswap/files/ramzswap/desactiva.sh | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: desactiva.sh
|
||
# Required-Start:
|
||
# Required-Stop:
|
||
# Default-Start:
|
||
# Default-Stop: 0,1,6
|
||
# Short-Description: desactiva la ramzswap
|
||
### END INIT INFO
|
||
|
||
for device in $(grep -E --only-matching '/dev/zram[[:digit:]]+' /proc/swaps); do
|
||
swapoff "$device"
|
||
done
|
||
# remove module, wait instead of failing if it's busy
|
||
rmmod --wait zram
|
||
tareas_puppet/portatiles/squeeze/comunes/port_ramzswap/files/ramzswap/ramzswap.sh | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: ramzswap.sh
|
||
# Required-Start: $remote_fs $syslog $all
|
||
# Required-Stop:
|
||
# Default-Start: 2 3 4 5
|
||
# Default-Stop: 0 1 6
|
||
# Short-Description: inicializa la ramzswap
|
||
### END INIT INFO
|
||
|
||
|
||
set -e
|
||
|
||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||
|
||
. /lib/init/swap-functions.sh
|
||
|
||
case "$1" in
|
||
|
||
start|"")
|
||
# Activa ramz
|
||
/root/ramzswap/inicializa.sh
|
||
;;
|
||
restart|reload|force-reload)
|
||
echo "Error: argument '$1' not supported" >&2
|
||
exit 3
|
||
;;
|
||
stop)
|
||
# Desactiva ramz
|
||
/root/ramzswap/desactiva.sh
|
||
;;
|
||
*)
|
||
echo "Usage: ramzwap.sh [start|stop]" >&2
|
||
exit 3
|
||
;;
|
||
esac
|
||
|
||
exit 0
|
||
|
||
tareas_puppet/portatiles/squeeze/comunes/port_ramzswap/files/ramzswap/inicializa.sh | ||
---|---|---|
#! /bin/sh
|
||
### BEGIN INIT INFO
|
||
# Provides: inicializa.sh
|
||
# Required-Start:
|
||
# Required-Stop:
|
||
# Default-Start: 2 3 4 5
|
||
# Default-Stop: 0 1 6
|
||
# Short-Description: inicializa la ramzswap
|
||
### END INIT INFO
|
||
|
||
|
||
get_number_of_present_cpus() {
|
||
cpulist=$( cat /sys/devices/system/cpu/present | tr ',' ' ' )
|
||
local num_cpus=0
|
||
for item in $cpulist; do
|
||
if ( echo $item | grep --silent '-' ); then
|
||
greater_cpunum=$( echo $item | cut -d '-' -f 2 )
|
||
lesser_cpunum=$( echo $item | cut -d '-' -f 1 )
|
||
local num_cpus=$(( $num_cpus + $greater_cpunum - $lesser_cpunum + 1 ))
|
||
else
|
||
local num_cpus=$(( $num_cpus + 1 ))
|
||
fi
|
||
done
|
||
echo $num_cpus
|
||
}
|
||
|
||
# get the number of CPUs
|
||
num_cpus=$(get_number_of_present_cpus)
|
||
|
||
# set decremented number of CPUs
|
||
decr_num_cpus=$((num_cpus - 1))
|
||
|
||
# get the amount of memory in the machine
|
||
mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching '[[:digit:]]+')
|
||
mem_total=$((mem_total_kb * 1024))
|
||
|
||
# determine modprobe parameter name, depending on kernel version
|
||
if (uname --release | grep -E --silent "^3\.[123]"); then
|
||
num_devices_parameter='zram_num_devices'
|
||
else
|
||
num_devices_parameter='num_devices'
|
||
fi
|
||
|
||
# load zram modules
|
||
modprobe zram $num_devices_parameter=$num_cpus
|
||
|
||
# initialize the devices, set total size to 1/2 RAM
|
||
for i in $(seq 0 $decr_num_cpus); do
|
||
echo $((mem_total / 2 / num_cpus)) > /sys/block/zram$i/disksize
|
||
done
|
||
|
||
# Creating swap filesystems
|
||
for i in $(seq 0 $decr_num_cpus); do
|
||
mkswap /dev/zram$i
|
||
done
|
||
|
||
# Switch the swaps on
|
||
for i in $(seq 0 $decr_num_cpus); do
|
||
swapon -p 100 /dev/zram$i
|
||
done
|
||
tareas_puppet/portatiles/squeeze/comunes/port_ramzswap/leeme.txt | ||
---|---|---|
Configura los portátiles con la swap tirando de memoria RAM antes que la swap de disco.
|
||
Esto hace que todos los procesos de I/O sean mucho más rápidos.
|
||
|
||
Se intenta gestionar más eficientemente el uso de la swap.
|
||
|
||
Por defecto la configuración de ramzswap es la siguiente:
|
||
|
||
memoria_total /2 / num_cpus (para equipos con 1 Gb y 2 cpus 2 swap de ram de 256 Mb).
|
||
|
||
Autor: Oscar Vaquero (Administración SI)
|
||
|
||
|
||
Modificación de los scripts para adaptarlos a cualquier sistema,
|
||
creación de tarea puppet y pruebas.
|
||
|
||
|
||
Francisco Rodrigo López
|
||
IES Javier García Téllez (Caceres).
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules.
|
||
Incluirlo en especifica-miniportatil-2011.pp
|
tareas_puppet/portatiles/squeeze/comunes/portatiles2012_puppetconf/files/puppet.conf | ||
---|---|---|
[main]
|
||
logdir=/var/log/puppet
|
||
vardir=/var/lib/puppet
|
||
ssldir=/var/lib/puppet/ssl
|
||
rundir=/var/run/puppet
|
||
factpath=$vardir/lib/facter
|
||
#pluginsync=true
|
||
server=puppetinstituto
|
||
runinterval=5400
|
||
syslogfacility=
|
||
report=true
|
||
|
||
[master]
|
||
templatedir=/var/lib/puppet/templates
|
||
|
tareas_puppet/portatiles/squeeze/comunes/portatiles2012_puppetconf/LEEME | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Destino : Portatiles de alumno con la imagen nueva
|
||
|
||
Acción : Eliminar el warning que da puppet al ejecutarse
|
||
|
||
Notas : Cambia el fichero de configuración (sustituye puppetmasterd por master)
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
Creado por:
|
||
|
||
Francisco Paniagua Sánchez
|
||
Administrador Informático del IES Francisco de Orellana (Trujillo).
|
||
24-Octubre-2012
|
||
tareas_puppet/portatiles/squeeze/comunes/portatiles2012_puppetconf/manifests/init.pp | ||
---|---|---|
class portatiles2012_puppetconf {
|
||
|
||
file {"/etc/puppet/puppet.conf":
|
||
owner => root, group => root, mode => 644,
|
||
source => "puppet:///portatiles2012_puppetconf/puppet.conf",
|
||
|
||
}
|
||
|
||
}
|
||
|
tareas_puppet/portatiles/squeeze/comunes/portatiles2012_menuelectricidad/LEEME | ||
---|---|---|
BREVE DESCRIPCION DE LA EJECUCION DEL MODULO
|
||
--------------------------------------------
|
||
|
||
Destino : Portatiles con la imagen nueva
|
||
|
||
Acción : Eliminar el menú electricidad del menú principal
|
||
|
||
Notas :
|
||
|
||
INSTRUCCIONES DE INSTALACION DEL MODULO
|
||
---------------------------------------
|
||
|
||
Desempaquetar en /etc/puppet/modules
|
||
Incluir la linea include "nombre_modulo" en /etc/puppet/manifests/classes/especifica-miniportatil-2011.pp
|
||
|
||
------------------------------------------------
|
||
|
||
Creado por:
|
||
|
||
Francisco Paniagua Sánchez
|
||
Administrador Informático del IES Francisco de Orellana (Trujillo).
|
||
24-Octubre-2012
|
||
tareas_puppet/portatiles/squeeze/comunes/portatiles2012_menuelectricidad/manifests/init.pp | ||
---|---|---|
class portatiles2012_menuelectricidad {
|
||
|
||
exec {"borrar-menu-electricidad":
|
||
|
||
command => "/bin/rm -f /usr/share/extra-xdg-menus/electronics.menu",
|
||
onlyif => "/bin/ls /usr/share/extra-xdg-menus/electronics.menu",
|
||
|
||
}
|
||
|
||
|
||
}
|
Exportar a: Unified diff
Reordenacion puppet-portatiles