Ask Your Question
0

How do I install my custom module to a node?

asked 2014-04-18 12:49:42 -0500

JM gravatar image

I have an agent, 'puppetbot.cisco.com' and a custom module I wrote, 'java'. For some odd reason I can't get my module picked up. Here are my files:

/etc/puppetlabs/puppet/manifests/site.pp

import "nodes"

filebucket { 'main': server => 'puppetbot', path   => false, }
File { backup => 'main' }
Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin" }

/etc/puppetlabs/puppet/manifests/nodes.pp

class baseclass {
  class { 'java': }
}

node basenode { include baseclass }

node 'puppetbot.cisco.com' inherits basenode { }

/etc/puppet/modules/java/manifests/init.pp

class java ($java_home = "/usr/java/jdk1.6.0_45", $java_bin_name = "jdk-6u45-linux-x64-rpm.bin" ) {

  notify { 'Hello World': }

  Exec { path => [ "/usr/bin", "/bin", "/usr/sbin" ] }

  file { "/tmp/${java_bin_name}":
    mode    => 0777,
    ensure  => "present",
    source  => "puppet:///modules/java/${java_bin_name}",
  }

  exec { "install java":
    command => "/tmp/${java_bin_name}",
    creates => $java_home,
    require => File["/tmp/${java_bin_name}"],
  }

  file { "${java_home}":
    ensure => "directory",
    mode   => 0644,
    require => Exec["install java"],
  }
}

$ puppet agent -t

Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Caching catalog for puppetbot.cisco.com
Info: Applying configuration version '1397685650'
Notice: Finished catalog run in 0.02 seconds

When I check the logs in my puppet dashboard instance I also don't see any mention of my 'java' module. Can anyone suggest what I'm doing wrong here?

edit retag flag offensive close merge delete

Comments

You can use functions like warning() in the manifest to get a simplistic trace of the compilation, see http://docs.puppetlabs.com/references/stable/function.html#warning

ffrank gravatar imageffrank ( 2014-04-19 05:44:59 -0500 )edit

That link doesn't actually have any documentation. Adding warning("hi") causes everything to freeze up on puppet agent -t.

JM gravatar imageJM ( 2014-04-21 11:45:37 -0500 )edit

Oh, that shouldn't happen. Your master freezes? You may wish to get to the bottom of this first then. Sorry for the mangled link, seems to be an issue with the commenting function. Just drop the trailing HTML tag. (The docu is not especially noteworthy, anyhow - your approach looks OK.)

ffrank gravatar imageffrank ( 2014-04-22 07:14:04 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-04-18 16:08:58 -0500

I am thinking that he is getting the default node. try change your site.pp to:

import "nodes.pp"

filebucket { 'main': server => 'puppetbot', path   => false, }
File { backup => 'main' }
Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin" }

if it didn't work maybe is the hostname because everything seems ok. try without fqdn just the hostname , here I just use the hostname for nodes:

class baseclass {
  class { 'java': }
}

node basenode { include baseclass }

node 'puppetbot' inherits basenode { }
edit flag offensive delete link more
0

answered 2014-06-01 10:49:40 -0500

melango gravatar image

Hi,

Did you check the modulepath in puppet.conf , is it pointing to /etc/puppet/modules ?
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-04-18 12:49:42 -0500

Seen: 605 times

Last updated: Jun 01 '14