Puppet: System Administration Automated

Puppet Training Schedule
Next Class July 27-29
New York, New York
Discount before July 1st

Font Installation Recipe

Installs font service, font packages and distributes selected custom truetype fonts via puppet. =

Tested on RHEL/CentOS 4.6

Create a dir (e.g. ) on the puppet master to hold any custom fonts you want to distribute and map it in fileserver.conf

[fonts]
path /var/lib/puppet/fonts
allow 192.168.0.0/24

Include fonts class on required nodes..

# fonts and font services

class fonts {
        $fontdir = "/usr/share/fonts/custom"

        package {"xorg-x11-xfs": ensure => present }
        package {"chkfontpath": ensure => present }

        # edit for required font packages
        package {"msttcorefonts": ensure => present }
        package {"urw-fonts": ensure => present }

        service {"xfs": enable => true, ensure => running }

        file {"${fontdir}":
                owner => root,
                group => root,
                mode => 644,
                ensure => directory,
                recurse => true,
                source => "puppet://$server/fonts/",
                notify => [Exec["make_font_metadata"], Exec["register_font_dir"], Service["xfs"]]
        }

        exec {"make_font_metadata":
                cwd => "${fontdir}",
                command => "/usr/bin/ttmkfdir . && /usr/X11R6/bin/mkfontdir .",
                refreshonly => true
        }

        exec {"register_font_dir":
                command => "/usr/sbin/chkfontpath --add=${fontdir}",
                unless => "/usr/sbin/chkfontpath | /bin/grep -q ${fontdir}",
        }
}