Once again: Ordering Problem

asked 2017-02-10 05:02:31 -0500

Hi folks, it seems to be a common problem and has already been discussed. But I can't find the solution on my own... ;-( I want to install the tool figlet to use it to create my motd-file. So I wrote a class "prep::preptools" with the the only goal to install figlet. In a second class "universal::motd" I placed a "require prep::preptools", but the statement fails. Please give me a hint, what am I missing? Puppet runs the classes in the right order, if I use the commented second content line.

puppet Version 3.8.5

Error output: Error: Failed to execute generator /bin/sh: Execution of '/bin/sh -c /usr/bin/figlet -c -w 60 puppetsenke' returned 127: /bin/sh: 1: /usr/bin/figlet: not found at /etc/puppet/TTL2/modules/universal/manifests/motd.pp:21 on node puppetsenke.test.home

Class sourcecode:

class universal::motd {

   require prep::preptools

   exec { 'mv /etc/motd /etc/motd.ori.puppet':
     path   => '/usr/bin:/usr/sbin:/bin',
     onlyif => [
                 'test -f /etc/motd',
                 'test ! -f /etc/motd.ori.puppet'
               ],
     before => File['create_motd']
   }

   file { 'create_motd':
            ensure => 'present',
            name    => '/etc/motd',
            mode    => '0644',
            owner   => 'root',
            group   => 'root',
            replace => 'no',
            content => generate('/bin/sh', '-c', "/usr/bin/figlet -c -w 60 ${hostname}")
            # content => generate('/bin/sh', '-c', "/bin/hostname")
   }
}
edit retag flag offensive close merge delete

Comments

Hello, It seems like your prep::preptools is the main Issue, it doesn't seem to install the needed Package. Did you check if figlet is well installed? Can you post the content of prep::preptools here?

stivesso gravatar imagestivesso ( 2017-02-11 05:59:10 -0500 )edit

Sure. Here it is... class prep::preptools { notify {"===> $title":} package { 'figlet': ensure => installed, } }

Thorsten_Baumeister gravatar imageThorsten_Baumeister ( 2017-02-12 11:25:04 -0500 )edit

Good, but it seems for me that you are trying to run figlet on the client. generate calls an external command on the Puppet master and returns the results of the command (make sure that figlet is on Puppet Master, not client... https://docs.puppet.com/puppet/latest/function.html#generate)

stivesso gravatar imagestivesso ( 2017-02-13 02:11:45 -0500 )edit