Ugo Bellavance
2012-Nov-20 13:06 UTC
[Puppet Users] Exception for one server on a basic setup
Hi, I''m not a total newbie with puppet, but I only use it for a few things and I''m not even using modules yet, mostly because I only deploy configuration files for now. I have a configuration for NTP that looks like this: class ntpd { package { "ntp": ensure => installed, } file { "/etc/ntp.conf": owner => root, group => root, mode => 0644, source => "puppet://$puppet_server/files/ntp.conf", require => Package["ntp"] } service { "ntpd": ensure => running, enable => true, hasrestart => true, hasstatus => true, require => [Package["ntp"], File["/etc/ntp.conf"]], subscribe => File["/etc/ntp.conf"], } } 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 setup is that I have 2 NTP servers that sync to servers on the net and all my servers and equipment sync to these two servers. Thanks, Ugo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/BVXQEl79aBgJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Matthew Burgess
2012-Nov-20 16:30 UTC
Re: [Puppet Users] Exception for one server on a basic setup
On Tue, Nov 20, 2012 at 1:06 PM, Ugo Bellavance <ugob@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. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ugo Bellavance
2012-Nov-20 19:25 UTC
Re: [Puppet Users] Exception for one server on a basic setup
On Tuesday, November 20, 2012 11:30:47 AM UTC-5, Matthew Burgess wrote:> > On Tue, Nov 20, 2012 at 1:06 PM, Ugo Bellavance <ug...@lubik.ca<javascript:>> > 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. >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? That is really nice. Too bad I don''t have much time to play with puppet. I know, puppet would save me time :). Thanks a lot! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/o8Ha-SOdiF4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ugo Bellavance
2012-Nov-20 20:13 UTC
Re: [Puppet Users] Exception for one server on a basic setup
On Tuesday, November 20, 2012 2:25:13 PM UTC-5, Ugo Bellavance wrote:> > > > On Tuesday, November 20, 2012 11:30:47 AM UTC-5, Matthew Burgess wrote: >> >> 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. >> > > 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. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/mdpZRuLU7FcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jakov Sosic
2012-Nov-20 22:27 UTC
Re: [Puppet Users] Exception for one server on a basic setup
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 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ugo Bellavance
2012-Nov-21 01:03 UTC
Re: [Puppet Users] Exception for one server on a basic setup
On Tuesday, November 20, 2012 3:13:03 PM UTC-5, Ugo Bellavance wrote:> > > > On Tuesday, November 20, 2012 2:25:13 PM UTC-5, Ugo Bellavance wrote: >> >> >> >> On Tuesday, November 20, 2012 11:30:47 AM UTC-5, Matthew Burgess wrote: >>> >>> 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. >>> >> >> 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. >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. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/E9ihPdvM_QcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ugo Bellavance
2012-Nov-21 01:05 UTC
Re: [Puppet Users] Exception for one server on a basic setup
On Tuesday, November 20, 2012 5:28:00 PM UTC-5, Jakov Sosic wrote:> > 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. >Makes sense, I''ll investigate later on. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/VBaN23JCNbIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.