Ask Your Question

Exec command on puppet master

asked 2013-06-10 10:11:16 -0500

banjer gravatar image

updated 2013-06-10 12:53:30 -0500

Every Linux host in our environment mounts a dedicated /usr/local, served via a NetApp filer. This allows us to offload some storage as well as provide snapshots.

When I provision a new host, I'd like to be able to automatically create the volume on the file server. I'm using run stages to ensure that the /usr/local mount is in place before any other puppet resources are applied. The ssh command below does the basic task of creating the necessary volume. I'm trying to run it from the puppet master using the generate function, but I ... (more)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-06-10 13:12:48 -0500

jgoldschrafe gravatar image

The command must be fully-qualified; for safety, generate does not search $PATH.


/usr/bin/ssh foo mkdir /vol/usr.local.${hostname}
edit flag offensive delete link more


That did it, thanks!

banjer gravatar imagebanjer ( 2013-06-11 12:32:11 -0500 )edit

On a side note, commands run via `generate` are run under the `puppet` user on the master. Also for safety reasons. I'd have to change the shell from `/sbin ...(more)

banjer gravatar imagebanjer ( 2013-06-13 05:03:38 -0500 )edit

answered 2013-06-10 11:26:41 -0500

bmurts gravatar image

Its likely the ${hostname} variable cannot be used and you need to explicitly declare the value.

I have a pre-stage class, called common, that creates a directory I used for file storage when Puppet downloads files to the agents. The Pre stage is executed before Main and each node inherits common. Below is a snippet from my site.pp. Can you something similar?

stage { [pre, post]: } Stage[pre] -> Stage[main] -> Stage[post]

node common { class { 'common': stage => pre } }

edit flag offensive delete link more


thanks for the info on stages, but I'm good with that aspect. I needed help with the error message, but @jgoldschrafe helped on that.

banjer gravatar imagebanjer ( 2013-06-11 12:31:42 -0500 )edit

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


Asked: 2013-06-10 10:11:16 -0500

Seen: 1,222 times

Last updated: Jun 10 '13