Para instalar el agente de puppet en Solaris 10 lo mas facil es recurrir a OpenCSW. De esta forma podemos descargar el paquete y sus correspondientes dependencias (a partir de Solaris 11.2 ya viene incluido en los repositorios oficiales).
Lo mas útil es crear un paquete que contenga el propio paquete de puppet y sus dependencias, de forma que podamos redistribuir dicho paquete en todos los servidores donde lo queramos instalar y no será necesario que todos los servidores tengan conexión a Internet. Para ello ejecutaremos:
root@solaris01 # /opt/csw/bin/pkgutil –stream –target=i386:5.10 –output /tmp/puppet.pkg –yes –download puppet
=> Fetching new catalog and descriptions (http://mirror.opencsw.org/opencsw/testing/i386/5.10) if available …
==> 3707 packages loaded from /var/opt/csw/pkgutil/catalog.mirror.opencsw.org_opencsw_testing_i386_5.10
Solving needed dependencies …
Solving dependency order …
Package list:
CSWalternatives-1.2,REV=2013.10.15 (opencsw/testing)
CSWaugeas-0.10.0,REV=2012.01.04 (opencsw/testing)
CSWcas-initsmf-1.49,REV=2013.03.13 (opencsw/testing)
CSWcas-usergroup-1.44,REV=2011.05.02 (opencsw/testing)
CSWcommon-1.5,REV=2010.12.11 (opencsw/testing)
CSWfacter-1.7.1,REV=2013.05.22 (opencsw/testing)
CSWlibgcc-s1-4.8.2,REV=2013.11.08 (opencsw/testing)
CSWlibgdbm4-1.9,REV=2011.10.24 (opencsw/testing)
CSWlibgnugetopt0-1.3,REV=2011.07.06 (opencsw/testing)
CSWlibiconv2-1.14,REV=2011.08.07 (opencsw/testing)
CSWliblzma5-5.0.5,REV=2013.07.05 (opencsw/testing)
CSWlibncurses5-5.9,REV=2011.11.21 (opencsw/testing)
CSWlibreadline6-6.2,REV=2011.07.02 (opencsw/testing)
CSWlibruby18-1-1.8.7p357,REV=2014.03.06 (opencsw/testing)
CSWlibssl1-0-0-1.0.1g,REV=2014.04.08 (opencsw/testing)
CSWlibxml2-2-2.9.1,REV=2013.08.16 (opencsw/testing)
CSWlibz1-1.2.8,REV=2013.09.23 (opencsw/testing)
CSWpuppet-2.7.23,REV=2013.08.15 (opencsw/testing)
CSWruby18-1.8.7p357,REV=2014.03.06 (opencsw/testing)
CSWrubyaugeas-0.4.1,REV=2012.03.25 (opencsw/testing)
CSWterminfo-5.9,REV=2011.11.21 (opencsw/testing)
Total size: 9.3 MB
A local copy of CSWcommon-1.5,REV=2010.12.11 exists and is of matching size.
=> Fetching CSWlibz1-1.2.8,REV=2013.09.23 (2/21) …
A local copy of CSWlibiconv2-1.14,REV=2011.08.07 exists and is of matching size.
=> Fetching CSWliblzma5-5.0.5,REV=2013.07.05 (4/21) …
=> Fetching CSWlibxml2-2-2.9.1,REV=2013.08.16 (5/21) …
=> Fetching CSWlibgcc-s1-4.8.2,REV=2013.11.08 (6/21) …
A local copy of CSWlibgnugetopt0-1.3,REV=2011.07.06 exists and is of matching size.
A local copy of CSWterminfo-5.9,REV=2011.11.21 exists and is of matching size.
=> Fetching CSWlibruby18-1-1.8.7p357,REV=2014.03.06 (9/21) …
=> Fetching CSWlibssl1-0-0-1.0.1g,REV=2014.04.08 (10/21) …
=> Fetching CSWlibgdbm4-1.9,REV=2011.10.24 (11/21) …
=> Fetching CSWalternatives-1.2,REV=2013.10.15 (12/21) …
A local copy of CSWcas-usergroup-1.44,REV=2011.05.02 exists and is of matching size.
A local copy of CSWcas-initsmf-1.49,REV=2013.03.13 exists and is of matching size.
A local copy of CSWlibncurses5-5.9,REV=2011.11.21 exists and is of matching size.
A local copy of CSWlibreadline6-6.2,REV=2011.07.02 exists and is of matching size.
A local copy of CSWaugeas-0.10.0,REV=2012.01.04 exists and is of matching size.
=> Fetching CSWruby18-1.8.7p357,REV=2014.03.06 (18/21) …
A local copy of CSWrubyaugeas-0.4.1,REV=2012.03.25 exists and is of matching size.
=> Fetching CSWfacter-1.7.1,REV=2013.05.22 (20/21) …
=> Fetching CSWpuppet-2.7.23,REV=2013.08.15 (21/21) …
Transforming CSWcommon …
Transforming CSWlibz1 …
Transforming CSWlibiconv2 …
Transforming CSWliblzma5 …
Transforming CSWlibxml2-2 …
Transforming CSWlibgcc-s1 …
Transforming CSWlibgnugetopt0 …
Transforming CSWterminfo …
Transforming CSWlibruby18-1 …
Transforming CSWlibssl1-0-0 …
Transforming CSWlibgdbm4 …
Transforming CSWalternatives …
Transforming CSWcas-usergroup …
Transforming CSWcas-initsmf …
Transforming CSWlibncurses5 …
Transforming CSWlibreadline6 …
Transforming CSWaugeas …
Transforming CSWruby18 …
Transforming CSWrubyaugeas …
Transforming CSWfacter …
Transforming CSWpuppet …
Transforming packages into stream (/tmp/puppet.pkg) …
Install commands in dependency safe order:
pkgadd -G -d /tmp/puppet.pkg CSWcommon
pkgadd -G -d /tmp/puppet.pkg CSWlibz1
pkgadd -G -d /tmp/puppet.pkg CSWlibiconv2
pkgadd -G -d /tmp/puppet.pkg CSWliblzma5
pkgadd -G -d /tmp/puppet.pkg CSWlibxml2-2
pkgadd -G -d /tmp/puppet.pkg CSWlibgcc-s1
pkgadd -G -d /tmp/puppet.pkg CSWlibgnugetopt0
pkgadd -G -d /tmp/puppet.pkg CSWterminfo
pkgadd -G -d /tmp/puppet.pkg CSWlibruby18-1
pkgadd -G -d /tmp/puppet.pkg CSWlibssl1-0-0
pkgadd -G -d /tmp/puppet.pkg CSWlibgdbm4
pkgadd -G -d /tmp/puppet.pkg CSWalternatives
pkgadd -G -d /tmp/puppet.pkg CSWcas-usergroup
pkgadd -G -d /tmp/puppet.pkg CSWcas-initsmf
pkgadd -G -d /tmp/puppet.pkg CSWlibncurses5
pkgadd -G -d /tmp/puppet.pkg CSWlibreadline6
pkgadd -G -d /tmp/puppet.pkg CSWaugeas
pkgadd -G -d /tmp/puppet.pkg CSWruby18
pkgadd -G -d /tmp/puppet.pkg CSWrubyaugeas
pkgadd -G -d /tmp/puppet.pkg CSWfacter
pkgadd -G -d /tmp/puppet.pkg CSWpuppet
=> Fetching new catalog and descriptions (http://mirror.opencsw.org/opencsw/testing/i386/5.10) if available …
==> 3707 packages loaded from /var/opt/csw/pkgutil/catalog.mirror.opencsw.org_opencsw_testing_i386_5.10
Solving needed dependencies …
Solving dependency order …
Package list:
CSWalternatives-1.2,REV=2013.10.15 (opencsw/testing)
CSWaugeas-0.10.0,REV=2012.01.04 (opencsw/testing)
CSWcas-initsmf-1.49,REV=2013.03.13 (opencsw/testing)
CSWcas-usergroup-1.44,REV=2011.05.02 (opencsw/testing)
CSWcommon-1.5,REV=2010.12.11 (opencsw/testing)
CSWfacter-1.7.1,REV=2013.05.22 (opencsw/testing)
CSWlibgcc-s1-4.8.2,REV=2013.11.08 (opencsw/testing)
CSWlibgdbm4-1.9,REV=2011.10.24 (opencsw/testing)
CSWlibgnugetopt0-1.3,REV=2011.07.06 (opencsw/testing)
CSWlibiconv2-1.14,REV=2011.08.07 (opencsw/testing)
CSWliblzma5-5.0.5,REV=2013.07.05 (opencsw/testing)
CSWlibncurses5-5.9,REV=2011.11.21 (opencsw/testing)
CSWlibreadline6-6.2,REV=2011.07.02 (opencsw/testing)
CSWlibruby18-1-1.8.7p357,REV=2014.03.06 (opencsw/testing)
CSWlibssl1-0-0-1.0.1g,REV=2014.04.08 (opencsw/testing)
CSWlibxml2-2-2.9.1,REV=2013.08.16 (opencsw/testing)
CSWlibz1-1.2.8,REV=2013.09.23 (opencsw/testing)
CSWpuppet-2.7.23,REV=2013.08.15 (opencsw/testing)
CSWruby18-1.8.7p357,REV=2014.03.06 (opencsw/testing)
CSWrubyaugeas-0.4.1,REV=2012.03.25 (opencsw/testing)
CSWterminfo-5.9,REV=2011.11.21 (opencsw/testing)
Total size: 9.3 MB
A local copy of CSWcommon-1.5,REV=2010.12.11 exists and is of matching size.
=> Fetching CSWlibz1-1.2.8,REV=2013.09.23 (2/21) …
A local copy of CSWlibiconv2-1.14,REV=2011.08.07 exists and is of matching size.
=> Fetching CSWliblzma5-5.0.5,REV=2013.07.05 (4/21) …
=> Fetching CSWlibxml2-2-2.9.1,REV=2013.08.16 (5/21) …
=> Fetching CSWlibgcc-s1-4.8.2,REV=2013.11.08 (6/21) …
A local copy of CSWlibgnugetopt0-1.3,REV=2011.07.06 exists and is of matching size.
A local copy of CSWterminfo-5.9,REV=2011.11.21 exists and is of matching size.
=> Fetching CSWlibruby18-1-1.8.7p357,REV=2014.03.06 (9/21) …
=> Fetching CSWlibssl1-0-0-1.0.1g,REV=2014.04.08 (10/21) …
=> Fetching CSWlibgdbm4-1.9,REV=2011.10.24 (11/21) …
=> Fetching CSWalternatives-1.2,REV=2013.10.15 (12/21) …
A local copy of CSWcas-usergroup-1.44,REV=2011.05.02 exists and is of matching size.
A local copy of CSWcas-initsmf-1.49,REV=2013.03.13 exists and is of matching size.
A local copy of CSWlibncurses5-5.9,REV=2011.11.21 exists and is of matching size.
A local copy of CSWlibreadline6-6.2,REV=2011.07.02 exists and is of matching size.
A local copy of CSWaugeas-0.10.0,REV=2012.01.04 exists and is of matching size.
=> Fetching CSWruby18-1.8.7p357,REV=2014.03.06 (18/21) …
A local copy of CSWrubyaugeas-0.4.1,REV=2012.03.25 exists and is of matching size.
=> Fetching CSWfacter-1.7.1,REV=2013.05.22 (20/21) …
=> Fetching CSWpuppet-2.7.23,REV=2013.08.15 (21/21) …
Transforming CSWcommon …
Transforming CSWlibz1 …
Transforming CSWlibiconv2 …
Transforming CSWliblzma5 …
Transforming CSWlibxml2-2 …
Transforming CSWlibgcc-s1 …
Transforming CSWlibgnugetopt0 …
Transforming CSWterminfo …
Transforming CSWlibruby18-1 …
Transforming CSWlibssl1-0-0 …
Transforming CSWlibgdbm4 …
Transforming CSWalternatives …
Transforming CSWcas-usergroup …
Transforming CSWcas-initsmf …
Transforming CSWlibncurses5 …
Transforming CSWlibreadline6 …
Transforming CSWaugeas …
Transforming CSWruby18 …
Transforming CSWrubyaugeas …
Transforming CSWfacter …
Transforming CSWpuppet …
Transforming packages into stream (/tmp/puppet.pkg) …
Install commands in dependency safe order:
pkgadd -G -d /tmp/puppet.pkg CSWcommon
pkgadd -G -d /tmp/puppet.pkg CSWlibz1
pkgadd -G -d /tmp/puppet.pkg CSWlibiconv2
pkgadd -G -d /tmp/puppet.pkg CSWliblzma5
pkgadd -G -d /tmp/puppet.pkg CSWlibxml2-2
pkgadd -G -d /tmp/puppet.pkg CSWlibgcc-s1
pkgadd -G -d /tmp/puppet.pkg CSWlibgnugetopt0
pkgadd -G -d /tmp/puppet.pkg CSWterminfo
pkgadd -G -d /tmp/puppet.pkg CSWlibruby18-1
pkgadd -G -d /tmp/puppet.pkg CSWlibssl1-0-0
pkgadd -G -d /tmp/puppet.pkg CSWlibgdbm4
pkgadd -G -d /tmp/puppet.pkg CSWalternatives
pkgadd -G -d /tmp/puppet.pkg CSWcas-usergroup
pkgadd -G -d /tmp/puppet.pkg CSWcas-initsmf
pkgadd -G -d /tmp/puppet.pkg CSWlibncurses5
pkgadd -G -d /tmp/puppet.pkg CSWlibreadline6
pkgadd -G -d /tmp/puppet.pkg CSWaugeas
pkgadd -G -d /tmp/puppet.pkg CSWruby18
pkgadd -G -d /tmp/puppet.pkg CSWrubyaugeas
pkgadd -G -d /tmp/puppet.pkg CSWfacter
pkgadd -G -d /tmp/puppet.pkg CSWpuppet
Como vemos, al final del proceso nos muestra el paso a paso de como instalarlo correctamente. Dichos comandos se pueden poner en un script de forma que la instalación consista en copiar el software y ejecutar el instalador:
root@solaris01 # ls -l | grep puppet
-rwxr-xr-x 1 root root 883 Apr 29 16:58 install_puppet.sh
-rw-r–r– 1 root root 32153600 Apr 29 16:56 puppet.pkg
root@solaris01 # ./install_puppet.sh
Una vez instalado podemos verificar el archivo de configuración y verificamos que en el hosts aparezca el servidor de puppet:
root@solaris01 # grep puppet /etc/hosts
X.X.X.X puppet
root@solaris01 # vi /opt/csw/etc/puppet/puppet.conf
# puppet.conf
#
# points puppet at OpenCSW default paths
[main]
confdir = /etc/opt/csw/puppet
config = $confdir/puppet.conf
vardir = /var/opt/csw/puppet
ssldir = $vardir/ssl
[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate «puppet« executable using the «–loadclasses«
# option.
# The default value is ‘$confdir/classes.txt’.
classfile = $vardir/classes.txt
# Where puppetd caches the local configuration. An
# extension indicating the cache format is added automatically.
# The default value is ‘$confdir/localconfig’.
localconfig = $vardir/localconfig
report = true
~
En este momento ya podemos realizar un test y firmar el certificado en la parte del servidor. A continuación habilitaríamos el servicio:
root@solaris01 # /opt/csw/bin/puppet agent –test
root@solaris01 # svcadm enable cswpuppetd
Para parar el agente hay que deshabilitar el servicio:
root@solaris01 # svcadm disable cswpuppetd
He creado algunos manifiestos específicos para solaris o que realizan una determinada acción en función del sistema operativo:
Despliegue de un fichero
root@solaris01 #cat modules/nicstat/manifests/init.pp
class nicstat{
if $::osfamily == ‘Solaris’ {
file { ‘/opt/utils/’:
ensure => directory,
}
file { ‘/opt/utils/nicstat’:
source => «puppet:///files/nicstat-solarisx86»,
}
} elsif $::osfamily == ‘RedHat’ {
file { ‘/opt/utils/’:
ensure => directory,
}
file { ‘/opt/utils/nicstat’:
source => «puppet:///files/nicstat-linux»,
}
}
}
class nicstat{
if $::osfamily == ‘Solaris’ {
file { ‘/opt/utils/’:
ensure => directory,
}
file { ‘/opt/utils/nicstat’:
source => «puppet:///files/nicstat-solarisx86»,
}
} elsif $::osfamily == ‘RedHat’ {
file { ‘/opt/utils/’:
ensure => directory,
}
file { ‘/opt/utils/nicstat’:
source => «puppet:///files/nicstat-linux»,
}
}
}
Customizar el MOTD:
node ‘solaris’’ {
include ftp
include nicstat
file { «/etc/motd»:
content => «Welcome
\tServer IP address: ${ipaddress}.
\tHostname: ${fqdn}
\tOperating System: ${operatingsystem}\tRelease: ${operatingsystemrelease}
\tOS family: ${osfamily}
\tKernel: ${kernel} ${kernelversion}
\tPuppet ${puppetversion}
\tCPU: ${physicalprocessorcount}\t\t\tCores: ${processorcount}
\tMemory: ${memorysize}\tSwap: ${swapsize}
\tTimeZone: ${timezone}
\tphyisical/virtual: ${virtual}\tType: ${type}
\tManufacturer: ${manufacturer}\tModel: ${productname}
\tSerial Number: ${serialnumber}
\n»
}
notice(«I am running on node ${fqdn}»)
}