Installing a puppet module on master with Puppetfile - puppet

I'm using R10K to manage my configuration files.
I want to install a puppet module on my master server using a Puppet file.
I go to the branch and add the following to Puppetfile:
mod 'puppetlabs-certregen', '0.2.0'
I then run puppet agent -t on the server. It seems the command is successful, in that the commands in my manifest are run, but when I run puppet certregen healthcheck the module doesn't seem to be installed.
What's the correct way to use the Puppetfile to install a module?

The Puppetfile is similar to a Ruby Gemfile, Python requirements.txt: it lists dependancies which are then installed by a separate tool.
For Puppetfiles, this is r10k.
It's documented here https://puppet.com/docs/pe/2018.1/puppetfile.html
You can also directly download the module with the command line:
puppet module install puppetlabs-certregen
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/Users/petersouter/.puppetlabs/etc/code/modules
└─┬ puppetlabs-certregen (v0.2.0)
└── puppetlabs-stdlib (v4.17.1)
Note, however, that r10k and puppet module install don't play well together:
Restriction: If you are using Code Manager or r10k, do not install, update, or uninstall modules with the puppet module command. With code management, you must install modules with a Puppetfile. Code management purges modules that were installed with the puppet module command. See the Puppetfile documentation for instructions.

Related

Jenkins NodeJS plugin: can't execute 'node'

When using the NodeJS tool on a slave that is configured with a global package, the following error is given:
env: can't execute 'node': No such file or directory
If the build runs on an executor in master, there is no error and the package is installed as expected.
I am using the kubernetes plugin with jenkins/jnlp-slave:3.27-1 as the slave image.
Jenkins Version: 2.164.2
Kubernetes Plugin: 1.14.9
NodeJS Plugin: 1.2.9
Note: This is not a duplicate of Jenkins - env: ‘node’: No such file or directory as I am not using the alpine image as was the problem in that question.
Same issue on my Jenkins.
The "download from nodejs.org" installer extracts the node package into a local directory.
It will then run "npm install -g" for each of the packages listed in the "Global npm packages to install" field in the NodeJS installer configuration ("Global tool configuration").
However, it does that before setting the system PATH to the directory where it extracted node, so npm will not find node.
I'm convinced that's a bug in the NodeJS Jenkins plugin. Your options are, as agusluc said, creating a custom jnlp-slave image (which is what I did), or file a bug with the developer of the plugin and hope it will be fixed.

Unable to run packages installed using npm on VM provisioned by Chef

I provisioned my VM on AWS using Chef and installed NodeJS using the NodeJS recipe (https://github.com/redguide/nodejs). When I do a global npm install of any package, I am not able to run that package using command line. Attached the screenshot below.
My poise-javascript cookbook has node_package and javascript_execute resources to take care of all the required path munging for you.
There are two options:
1)add the /usr/local/nodejs-binary-6.3.0/bin/ to PATH variable.
Or
2)Run /usr/local/nodejs-binary-6.3.0/bin/http-server.
The npm package binaries are not added to path by default. I would prefer option 2 to keep the path unpolluted

How to run Node.js and Ruby tests within one project on Travis CI

I have a repo that contains multiple components, most of them in JavaScript (Node.js) and one written in Ruby (Ruby on Rails). I'd like to have one .travis.yml file that triggers one build that runs all the tests for each of the components. According to this Travis CI Google Group thread, there is no official support for this for now.
My directory structure looks like this:
.
├── buildserver
├── core
├── extensions
├── webapp
├── Vagrantfile
├── package.json
├── .travis.yml
└── Makefile
I want to be able to run specific versions of Ruby (2.2.2) and Node.js (0.12.2). I already have a make target, so make test runs appropriate test suite in each subdirectory.
It turns out that every VM, that runs your isolated test suite on Travis CI, comes with Node.js and Ruby pre-installed. By default you get Ruby 1.9.3 and Node.js 0.12.2 (but that may change as Travis team updates their environment), so even though you can only specify one language (e.g. language: Ruby) in your .travis.yml file, you can still run both Ruby and Node.js programs on Travis CI VM.
I decided to go with Node.js language set-up and install appropriate Ruby version (but I could have done the opposite with the same effect).
Here is my .travis.yml config file:
language: node_js
node_js:
- 0.12.2
addons:
postgresql: "9.4"
before_install:
- rvm install 2.2.2
install:
# run whatever you have to do here. I have a Makefile that lets you install
# all Node.js-related or Ruby-related dependencies as one step.
- make npm
- make bundler
before_script:
# My Rails app lives in a subdirectory. I want to make sure that
# my database is ready before I start running RSpec tests
- psql -c 'create database test_db;' -U postgres
# I use separate database.yml config for Travis CI
- cp webapp/config/database.travis.yml webapp/config/database.yml
script:
# `test` target executes `bundle exec rspec spec` and `npm run test`
# in all appropriate subdirectories
- make test

how to start puppet master while installing from source code..?

I have tried to install from source code, I checked out from github and installed the puppet. I followed the following link to install puppet. In this process I am not able to start the puppet master.
https://docs.puppetlabs.com/guides/install_puppet/from_source.html
I am getting this following error:
$: bundle exec puppet master --verbose --no-daemonize --autosign true
Error: Could not run: cannot load such file -- puppet/network/server
anyhelp would be appreciated ..!!!

Bower, Grunt on Ubuntu 12.04 - command not found

I've installed bower and grunt on my machine but non of it works. I get :command not found for both.
I've placed paths to bower and grunt in .bash_profile file, like:
export PATH="/home/user/.node/lib/node_modules/grunt-cli/bin:$PATH"
export PATH="/home/user/.node/lib/node_modules/bower/bin:$PATH"
It feels like packages are installed correctly but it can't be found.
Npm and node is located in home/user/.node and home/user/.npm directories is this is the right place for it?
which bower/grunt outputs nothing
Just had to remind myself of this one, to set up environment on a new machine.
As per http://gruntjs.com/getting-started, there are two steps required for installation and use of Grunt.js task runner on a given project:
You should globally install only 'grunt-cli', the Grunt Command Line Interface. This will put the grunt command on your system path. This is achieved by running npm install -g grunt-cli, which may require root privileges depending on your setup.
You should locally install the grunt task runner proper. This is achieved by running npm install, after adding the desired version of Grunt.js to your project's package.json file. This will install the specific version of Grunt.js described in your project's package.json, under the devDependencies section. This is the file used by nodejs to describe project development and deployment dependencies, among other stuff.
I managed to fix it by adding paths to .bashrc file, like:
PATH=$PATH:/home/user/.node/lib/node_modules/grunt-cli/bin
PATH=$PATH:/home/user/.node/lib/node_modules/bower
Reference

Resources