Ask Your Question
0

Can you save files to puppet master fileserver?

asked 2014-10-21 11:02:36 -0500

whitmojm gravatar image

Hello, I have a puppetmaster that ensures, for example, that webserver1 is running HTTPD. we also have a xymon server. I would like to use puppet master to ensure HTTPD is running but also write a config file to the puppetmaster file store for the xymon server, which we also monitor with xymon.

So my code looks something like this, roughly.

node 'webserver1' { file {"test": ensure => file, name => "puppet:///files/hosts/xymonserver/etc/xymon/conf.d/${hostname}.SVC.httpd.cfg", content => 'HOST=${hostname} \n SVC httpd 1 1', } }

node 'xymonserver' { file {'/etc/xymon/conf.d': ensure => directory, source => 'puppet:///files/hosts/xymonserver/etc/xymon/conf.d', } }

is this possible?

edit retag flag offensive close merge delete

Comments

Heads up: Ask.puppetlabs.com uses markdown. In markdown, newlines are squashed. To print code with preserved spacing, indent it by 4 spaces

cbarbour gravatar imagecbarbour ( 2014-10-21 18:47:08 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-10-21 13:24:48 -0500

Since functions are run on the puppet master I wonder if the best way would be to write a quick and easy custom function that you could call that would automatically add the file and then be served out to xymon.

edit flag offensive delete link more

Comments

Can you give me a brief example of such a function?

whitmojm gravatar imagewhitmojm ( 2014-10-21 13:30:51 -0500 )edit
0

answered 2014-10-21 18:51:03 -0500

cbarbour gravatar image

The normal solution for this problem is to use service discovery.

If your needs are simple, Puppet just happens to provide service discovery via Exported Resources

Exported resources require PuppetDB and a PostgreSQL server be setup, but are otherwise pretty simple to work with. Puppet Labs helpfully provides a PuppetDB module to help get you started.

If your needs are more complex, you can look at tools such as Consul.

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-10-21 11:02:36 -0500

Seen: 152 times

Last updated: Oct 21 '14