Puppet/clases

De FESOL. Proyectos de Software Libre ULS
Revisión del 17:17 30 oct 2013 de Manuelflores (discusión | contribuciones)
(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar

Sincronización de hora

class ntp {
	package { ntp: 
		ensure => present,
	}
	file { "/etc/ntp.conf":
		owner	 => root,
 		group	 => root,
		mode	=> 444,
		backup => false,
		source	=> "puppet:///uesconfigs/etc/ntp.conf",
		require => Package["ntp"],
	}
	service { "ntp":
		enable => true ,
		ensure => running,
		subscribe => [Package[ntp], File["/etc/ntp.conf"],],
	}
}

Archivo ntp.conf, asumiendo que los servidores de hora son 192.168.0.132 y 192.168.0.133

driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 192.168.0.132
server 192.168.0.133
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1


Paquetes Básicos

class paquetes_basicos {
       $seguridad = ["fail2ban", "linux-image-amd64", "logwatch",  ]
       $herramientassis = [ "vim" , "tree", "less","rsync", "strace", "rdiff", ]
       $herramientasadmin = [ "openssh-server","sudo", "screen",  ]
       $herramientasred= [ "mtr-tiny", "lynx", "links2", ]
       $herramientasescritorio= [ "gnome-dektop-environment", "inkscape", "shutter", "gimp", "libreoffice", ]
       $redes1 = [ "mtr-tiny", "nmap", "gns3", "libreoffice", "libreoffice-l10n-es", "libreoffice-help-es", ] 
       
       package { $seguridad: 
		ensure => latest }
       package { $herramientassis:
               ensure => present }
       package { $herramientasadmin:
               ensure => present }
       package { $herramientasred:
               ensure => present }
       package { $herramientasescritorio:
               ensure => present }
       package { $redes1:
               ensure => present }

	exec { "vimrc syntax":
	    command => "sed -i 's/\"syntax on/syntax on/g' /etc/vim/vimrc",
	    onlyif => "bash -c \"if [ $(cat /etc/vim/vimrc|grep  'syntax on'|wc -l) -eq 1 ]; then echo 'true' ; else echo 'false'; fi \"",
	    path => "/bin:/usr/sbin:/usr/bin",
	    require => Package["vim"],
  }	
}