FAQ
Hi all,

How do I reference the first member in the $ntpd_servers array in the code
below. Any pointers to the official Puppet (or Ruby?) documentation would
be much appreciated.

class ntp {

$ntpd_servers = [ "0.rhel.pool.ntp.org", "1.rhel.pool.ntp.org",
"2.rhel.pool.ntp.org" ]

exec { "set_clock":
subscribe => File["/etc/ntp.conf"],
command => "/sbin/service ntpd stop && /sbin/ntpdate
<FIRST_MEMBER_OF_ARRAY> && /sbin/service ntpd start",
refreshonly => true;
}

}

Regards,
Willem.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Ellison Marks at Mar 26, 2013 at 4:38 pm
    It's just normal subscript notation.

    $ntpd_servers[0]

    http://docs.puppetlabs.com/puppet/3/reference/lang_datatypes.html#arrays

    Just as a note, ntpd has an option, -g I believe, that's used to set the
    time and start the service all at once. I think it's a little preferred
    over ntpdate these days. Not sure what flavor of linux you're running, but
    on centos, that flag is default when run through he init script. It would
    probably be cleaner for you if you could use that flag and then just a
    service resource subscribed to the conf file.
    On Tuesday, March 26, 2013 6:01:44 AM UTC-7, Willem Bos wrote:

    Hi all,

    How do I reference the first member in the $ntpd_servers array in the code
    below. Any pointers to the official Puppet (or Ruby?) documentation would
    be much appreciated.

    class ntp {

    $ntpd_servers = [ "0.rhel.pool.ntp.org", "1.rhel.pool.ntp.org", "
    2.rhel.pool.ntp.org" ]

    exec { "set_clock":
    subscribe => File["/etc/ntp.conf"],
    command => "/sbin/service ntpd stop && /sbin/ntpdate
    <FIRST_MEMBER_OF_ARRAY> && /sbin/service ntpd start",
    refreshonly => true;
    }

    }

    Regards,
    Willem.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Willem Bos at Mar 28, 2013 at 1:07 pm
    O man, I should have thought of that myself... Thanks.

    I didn't want to use '-g' as it enables large time changes but I - just
    know - found out that is the default on RHEL6. So I'll probably just add
    '-g' to /etc/sysconfig/ntpd on RHEL5 also :-)

    Regards,
    Willem.
    On Tuesday, March 26, 2013 5:38:04 PM UTC+1, Ellison Marks wrote:

    It's just normal subscript notation.

    $ntpd_servers[0]

    http://docs.puppetlabs.com/puppet/3/reference/lang_datatypes.html#arrays

    Just as a note, ntpd has an option, -g I believe, that's used to set the
    time and start the service all at once. I think it's a little preferred
    over ntpdate these days. Not sure what flavor of linux you're running, but
    on centos, that flag is default when run through he init script. It would
    probably be cleaner for you if you could use that flag and then just a
    service resource subscribed to the conf file.
    On Tuesday, March 26, 2013 6:01:44 AM UTC-7, Willem Bos wrote:

    Hi all,

    How do I reference the first member in the $ntpd_servers array in the
    code below. Any pointers to the official Puppet (or Ruby?) documentation
    would be much appreciated.

    class ntp {

    $ntpd_servers = [ "0.rhel.pool.ntp.org", "1.rhel.pool.ntp.org", "
    2.rhel.pool.ntp.org" ]

    exec { "set_clock":
    subscribe => File["/etc/ntp.conf"],
    command => "/sbin/service ntpd stop && /sbin/ntpdate
    <FIRST_MEMBER_OF_ARRAY> && /sbin/service ntpd start",
    refreshonly => true;
    }

    }

    Regards,
    Willem.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMar 26, '13 at 3:31p
activeMar 28, '13 at 1:07p
posts3
users2
websitepuppetlabs.com

2 users in discussion

Willem Bos: 2 posts Ellison Marks: 1 post

People

Translate

site design / logo © 2022 Grokbase