Re: [Puppet Users] Exception for one server on a basic setup

66 views
Skip to first unread message

Matthew Burgess

unread,
Nov 20, 2012, 11:30:39 AM11/20/12
to puppet...@googlegroups.com
On Tue, Nov 20, 2012 at 1:06 PM, Ugo Bellavance <ug...@lubik.ca> wrote:

> However, I would need to push a different file to my NTP servers (the
> puppet://$puppet_server/files/ntp.conf) are for clients. How can I do that?
> Can I simply declare my two servers in a node declaration and set a variable
> in it and then use a puppet:// path that includes a variable?

The simplest option here is to just do the following, taking your
existing ntp.conf file stanza as an example:

class ntpd {
package { "ntp":
ensure => installed,
}
file { "/etc/ntp.conf":
owner => root,
group => root,
mode => 0644,
source => ["puppet://$puppet_server/files/ntp.conf.$host,
"puppet://$puppet_server/files/ntp.conf"],
require => Package["ntp"]
}

Puppet will use the first file that it finds in the "source" array.
For a more in depth explanation, see the 'source' parameter
description at http://docs.puppetlabs.com/references/3.0.latest/type.html#file.

Hope this helps,

Matt.

Ugo Bellavance

unread,
Nov 20, 2012, 3:13:03 PM11/20/12
to puppet...@googlegroups.com


On Tuesday, November 20, 2012 2:25:13 PM UTC-5, Ugo Bellavance wrote:

Ok, so the process would be to first change my config to have the two sources as you described, then have a file that has the "ntp server" confi, called ntp.conf.ntp1.mydomain.com and symlink it to ntp.conf.ntp2.mydomain.com?

 
I tested it and at first it didn't work, so I changed $host for $fqdn.  I tested it and it worked.  I haven't tested the symlink yet but I'll do that tonight.

Jakov Sosic

unread,
Nov 20, 2012, 5:27:42 PM11/20/12
to puppet...@googlegroups.com
On 11/20/2012 02:06 PM, Ugo Bellavance wrote:

> The setup is that I have 2 NTP servers that sync to servers on the
> and all my servers and equipment sync to these two servers.

I created two classes for this purpose - ntp::client and ntp::server,
and use data from hiera. Although I could maybe use just one class and
depending on hiera options set up client or server on a node. I
recommend this approach, combined with ruby erb template for ntp.conf.



--
Jakov Sosic
www.srce.unizg.hr

Ugo Bellavance

unread,
Nov 20, 2012, 8:03:14 PM11/20/12
to puppet...@googlegroups.com

It didn't work with the symlink so I did a simple copy.  I don't know if a hard link would have worked but the copy works and it is not that bad to maintain.

Ugo Bellavance

unread,
Nov 20, 2012, 8:05:41 PM11/20/12
to puppet...@googlegroups.com

Makes sense, I'll investigate later on.
Reply all
Reply to author
Forward
0 new messages