node.jspuppetpuppetlabs-apache

Installing nodejs via puppet fails


Basically I want to do the following using puppet:

1.sudo yum install nodejs npm --enablerepo=epel
setup nodejs evironment(latest stable version) on puppet agent
2.sudo yum install git-(install git)
3.git clone git@gitlab.ishwarya.net:hello-world/nodejs-helloworld.git -(git clone the application repo)
4.Run the application
npm install
npm start
npm test

I am new to puppet configurtion management tool. So far,I have done puppet master -agent setup.

sudo yum install puppet-server on puppet master node
sudo yum install puppet on agent node

and was able to successfully install apache on my agent.

I am using puppet version 3.8.7 on RHEL. As a first step I need to install nodejs on puppet agent to run my application.

Installed the puppetlabs-nodejs module

puppet module install puppetlabs-nodejs

/etc/puppet/manifests/site.pp on master node contains below code:

class { '::nodejs':
  nodejs_dev_package_ensure => 'present',
  npm_package_ensure        => 'present',
  repo_class                => '::epel',
}

when i run the below command on agent i get this error:

puppet agent -t 

the code fails with below error

 Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: 
Invalid resource type gpg_key at /etc/puppet/modules/nodejs/manifests/repo/nodesource/yum.pp:58 on node ip-**********
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Solution

  • You should either install the puppetlabs-nodejs module or write it yourself. Either way you should have a nodejs module which has the nodejs class defined in it's init.pp file.

    Make sure the something like include 'nodejs' is called withing your manifest