[Puppet Users] Re: Reference first member of array in manifest

2013-03-28 Thread Willem Bos
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+unsubscr...@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.




[Puppet Users] Re: Reference first member of array in manifest

2013-03-26 Thread Ellison Marks
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+unsubscr...@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.