Re: [Puppet Users] Help with NTP module provided by puppetlabs

2015-08-17 Thread Richard Gray

Hi,

If you have Foreman configured as an ENC, the location parameter will be 
available to Hiera as a fact. e.g. In the master section of puppet.conf, 
you'll have something like (node.rb comes from Foreman):


external_nodes = /etc/puppet/node.rb

Then in hiera.yaml you can reference the location fact with 
#{::location}. Parameters such as location are passed to puppet from an 
ENC through the hash structure described at 
https://docs.puppetlabs.com/guides/external_nodes.html#enc-output-format


Cheers,
Richard

On 17/08/15 19:17, Eddie Mashayev wrote:

Hi Richard,

Just wondering, I do have now a locations configured on my Foreman 
(:locations_enabled: true), how can I access this data?
For example if I have a Facter variable named $location or $os_version 
so I can use it on mypuppet scripts. How can I use Foreman locations 
variable?

Hope I made myself clear :)


Thanks,

EddieM


On Tuesday, August 11, 2015 at 6:12:58 PM UTC+3, Eddie Mashayev wrote:

Thanks for the help :)

On Tuesday, August 11, 2015 at 1:24:48 AM UTC+3, Richard Gray wrote:



On 10/08/15 20:12, Martin Alfke wrote:

You need to create a hiera.yaml config file.
The config file may look like this:

:backends:
   - yaml
:yaml:
   :datadir: ‘/etc/puppet/data’
:hierachy:
   - “nodes/#{::certname}”
   - “location/#{::timezone}”
   - global



Further to Martin's comment, you may be interested to know
that the Foreman location and environment are available to
Hiera, so you might prefer to use those rather than the
timezone fact. E.g.

:backends:
   - yaml
:yaml:
   :datadir: ‘/etc/puppet/data’
:hierachy:
   - “nodes/#{::certname}”
   - “location/#{::location}”
   - global

-- 


*Richard Gray* | Senior Operations Engineer
*DDI:* +64 9 950 2196 *Fax:* +64 9 302 0518
*Mobile:* +64 21 050 8178 *Freephone:*0800 SMX SMX (769 769)
*SMX Limited:* Level 15, 19 Victoria Street West, Auckland,
New Zealand
*Web:* http://smxemail.com
SMX | Cloud Email Hosting  Security

This email has been filtered by SMX. For more information
visit smxemail.com http://smxemail.com/.

--
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 
mailto:puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/bd0b95d1-bf7d-4c2a-aab8-50cfbba97906%40googlegroups.com 
https://groups.google.com/d/msgid/puppet-users/bd0b95d1-bf7d-4c2a-aab8-50cfbba97906%40googlegroups.com?utm_medium=emailutm_source=footer.

For more options, visit https://groups.google.com/d/optout.


--

*Richard Gray* | Senior Operations Engineer
*DDI:* +64 9 950 2196 *Fax:* +64 9 302 0518
*Mobile:* +64 21 050 8178 *Freephone:*0800 SMX SMX (769 769)
*SMX Limited:* Level 15, 19 Victoria Street West, Auckland, New Zealand
*Web:* http://smxemail.com
SMX | Cloud Email Hosting  Security

_

This email has been filtered by SMX. For more info visit http://smxemail.com
_

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/55D258F5.6030107%40smxemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Help with NTP module provided by puppetlabs

2015-08-17 Thread Eddie Mashayev
Hi Richard,

Just wondering, I do have now a locations configured on my Foreman 
(:locations_enabled: true), how can I access this data? 
For example if I have a Facter variable named $location or $os_version so I 
can use it on mypuppet scripts. How can I use Foreman locations variable?
Hope I made myself clear :)


Thanks,

EddieM

On Tuesday, August 11, 2015 at 6:12:58 PM UTC+3, Eddie Mashayev wrote:

 Thanks for the help :)

 On Tuesday, August 11, 2015 at 1:24:48 AM UTC+3, Richard Gray wrote:



 On 10/08/15 20:12, Martin Alfke wrote:

 You need to create a hiera.yaml config file.
 The config file may look like this:

 :backends:
   - yaml
 :yaml:
   :datadir: ‘/etc/puppet/data’
 :hierachy:
   - “nodes/#{::certname}”
   - “location/#{::timezone}”
   - global



 Further to Martin's comment, you may be interested to know that the 
 Foreman location and environment are available to Hiera, so you might 
 prefer to use those rather than the timezone fact. E.g.

 :backends:
   - yaml
 :yaml:
   :datadir: ‘/etc/puppet/data’
 :hierachy:
   - “nodes/#{::certname}”
   - “location/#{::location}”
   - global

 -- 

 *Richard Gray* | Senior Operations Engineer 
 *DDI:* +64 9 950 2196 *Fax:* +64 9 302 0518 
 *Mobile:* +64 21 050 8178 *Freephone:*0800 SMX SMX (769 769) 
 *SMX Limited:* Level 15, 19 Victoria Street West, Auckland, New Zealand 
 *Web:* http://smxemail.com 
 [image: SMX | Cloud Email Hosting  Security] 
 This email has been filtered by SMX. For more information visit 
 smxemail.com.



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/bd0b95d1-bf7d-4c2a-aab8-50cfbba97906%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Help with NTP module provided by puppetlabs

2015-08-11 Thread Eddie Mashayev
Thanks for the help :)

On Tuesday, August 11, 2015 at 1:24:48 AM UTC+3, Richard Gray wrote:



 On 10/08/15 20:12, Martin Alfke wrote:

 You need to create a hiera.yaml config file.
 The config file may look like this:

 :backends:
   - yaml
 :yaml:
   :datadir: ‘/etc/puppet/data’
 :hierachy:
   - “nodes/#{::certname}”
   - “location/#{::timezone}”
   - global



 Further to Martin's comment, you may be interested to know that the 
 Foreman location and environment are available to Hiera, so you might 
 prefer to use those rather than the timezone fact. E.g.

 :backends:
   - yaml
 :yaml:
   :datadir: ‘/etc/puppet/data’
 :hierachy:
   - “nodes/#{::certname}”
   - “location/#{::location}”
   - global

 -- 

 *Richard Gray* | Senior Operations Engineer 
 *DDI:* +64 9 950 2196 *Fax:* +64 9 302 0518 
 *Mobile:* +64 21 050 8178 *Freephone:*0800 SMX SMX (769 769) 
 *SMX Limited:* Level 15, 19 Victoria Street West, Auckland, New Zealand 
 *Web:* http://smxemail.com 
 [image: SMX | Cloud Email Hosting  Security] 
 This email has been filtered by SMX. For more information visit 
 smxemail.com.


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/862195dc-f316-42a1-a330-f55bf7fb5830%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Help with NTP module provided by puppetlabs

2015-08-10 Thread Richard Gray



On 10/08/15 20:12, Martin Alfke wrote:

You need to create a hiera.yaml config file.
The config file may look like this:

:backends:
   - yaml
:yaml:
   :datadir: ‘/etc/puppet/data’
:hierachy:
   - “nodes/#{::certname}”
   - “location/#{::timezone}”
   - global



Further to Martin's comment, you may be interested to know that the 
Foreman location and environment are available to Hiera, so you might 
prefer to use those rather than the timezone fact. E.g.


:backends:
  - yaml
:yaml:
  :datadir: ‘/etc/puppet/data’
:hierachy:
  - “nodes/#{::certname}”
  - “location/#{::location}”
  - global

--

*Richard Gray* | Senior Operations Engineer
*DDI:* +64 9 950 2196 *Fax:* +64 9 302 0518
*Mobile:* +64 21 050 8178 *Freephone:*0800 SMX SMX (769 769)
*SMX Limited:* Level 15, 19 Victoria Street West, Auckland, New Zealand
*Web:* http://smxemail.com
SMX | Cloud Email Hosting  Security

_

This email has been filtered by SMX. For more info visit http://smxemail.com
_

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/55C9229C.4010605%40smxemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Help with NTP module provided by puppetlabs

2015-08-10 Thread Martin Alfke

On 10 Aug 2015, at 09:54, Eddie Mashayev eddie...@gmail.com wrote:

 Hi Martin, 
 
 Thanks for the help. I used the second approach. 
 
 1) I’ve created custom fact to identify the server location (I’m using the 
 timezone fact) – Now I’m able to identify all my servers by location. 
 2) I’m not sure about the second part “put ntp::servers into the appropriate 
 hiera data hierarchy” – I’m using Foreman and NOT Puppet enterprise if it 
 matters. Can you elaborate more how to implement it right, maybe add some 
 code if possible.

Hiera is not related to Puppet Enterprise.
Hiera is a data backend for automatic parameter lookups.
see http://docs.puppetlabs.com/hiera/latest/

You need to create a hiera.yaml config file.
The config file may look like this:

:backends:
  - yaml
:yaml:
  :datadir: ‘/etc/puppet/data’
:hierachy:
  - “nodes/#{::certname}”
  - “location/#{::timezone}”
  - global

In your hiera data directory you can provide yaml files for hierarchies (you 
don’t have to, but you can!)

/etc/puppet/data/
  - nodes/foo.bar.domain.com.yaml # has host specific parameters
  - location/CEST.yaml # has parameters for CEST timezone
  - location/PDT.yaml# has parameters for PDT timezone systems
  - global.yaml  # has global parameters

Hiera parses the data hierarchy and uses the first match.
To allow dynamic data lookup the variable names from the module have to be 
prefixed with the class name where they are used.
Note: this only works with parameterised classes, not with normal variables 
inside a manifest.

With foreman you should also be able to create a group setting based on 
timezone fact (I don’t have access to foreman right now, so I can not verify).

Best,
Martin

 
 Thanks,
 EddieM
 
 On Sunday, August 9, 2015 at 5:35:07 PM UTC+3, Martin Alfke wrote:
 Hi Eddie, 
 
 On 09 Aug 2015, at 16:25, Eddie Mashayev eddi...@gmail.com wrote: 
 
  Hi All, 
  
  I have many servers spread in 3 different time zones USA (NY and San 
  Francisco) and also in ISR. Have 3 NTP servers, one NTP server in each 
  location. 
  https://forge.puppetlabs.com/puppetlabs/ntp module is letting you to insert 
  an array of NTP servers 
  
  class { '::ntp': 
  servers = [ 'ntp1.corp.com', 'ntp2.corp.com' ], 
  } 
  
  I can override this array but the problem is how to fit the correct NTP 
  server to each server in the different location. 
  In other words, how can I modified the puppet module to fit server to the 
  correct NTP Server by locations. 
  
  For example - I thought using the server prefix name to choose the right 
  NTP server, for example if this server is located in NY so it prefix name 
  is ny-{server name} so I can fit it to NY NTP server but it look like a 
  headache to do it. 
  
  Do you have any idea how can it be done in most efficient way with the NTP 
  module provided by puppetlabs. 
 
 Several solutions: 
 
 1. write wrapper module per data center: 
 
 class ny_ntp { 
   class { ‘::ntp’: 
 server = [‘ny_ntp.corp.com’], 
   } 
 } 
 
 class sf_ntp { 
   class { ‘::ntp’: 
 servers = [‘sf_ntp.corp.com’], 
   } 
 } 
 
 class isr_ntp { 
   class { ‘::ntp’: 
servers = [‘isr_ntp.corp.com’], 
   } 
 } 
 
 use one of the the wrapper class within node classification 
 
 2. use hiera 
 
 provide a custom fact to identify location per server and put ntp::servers 
 into the appropriate hiera data hierarchy. 
 
 Best, 
 Martin 
 
 
  
  
  Thanks, 
  EddieM 
  
  -- 
  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...@googlegroups.com. 
  To view this discussion on the web visit 
  https://groups.google.com/d/msgid/puppet-users/8cdf1ae0-46c8-4de6-bb06-9f42bdbd31ed%40googlegroups.com.
   
  For more options, visit https://groups.google.com/d/optout. 
 
 
 -- 
 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 view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/d7398ad5-9b31-42e5-b3ee-d1eb889a8356%40googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/DD001BB3-D530-4509-AFDE-051381F58E29%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Help with NTP module provided by puppetlabs

2015-08-10 Thread Eddie Mashayev
Hi Martin, 

Thanks for the help. I used the second approach. 

1) I’ve created custom fact to identify the server location (I’m using the 
timezone fact) – Now I’m able to identify all my servers by location. 
2) I’m not sure about the second part “put ntp::servers into the 
appropriate hiera data hierarchy” – I’m using Foreman and NOT Puppet 
enterprise if it matters. Can you elaborate more how to implement it right, 
maybe add some code if possible.

Thanks,
EddieM

On Sunday, August 9, 2015 at 5:35:07 PM UTC+3, Martin Alfke wrote:

 Hi Eddie, 

 On 09 Aug 2015, at 16:25, Eddie Mashayev eddi...@gmail.com javascript: 
 wrote: 

  Hi All, 
  
  I have many servers spread in 3 different time zones USA (NY and San 
 Francisco) and also in ISR. Have 3 NTP servers, one NTP server in each 
 location. 
  https://forge.puppetlabs.com/puppetlabs/ntp module is letting you to 
 insert an array of NTP servers 
  
  class { '::ntp': 
  servers = [ 'ntp1.corp.com', 'ntp2.corp.com' ], 
  } 
  
  I can override this array but the problem is how to fit the correct NTP 
 server to each server in the different location. 
  In other words, how can I modified the puppet module to fit server to 
 the correct NTP Server by locations. 
  
  For example - I thought using the server prefix name to choose the right 
 NTP server, for example if this server is located in NY so it prefix name 
 is ny-{server name} so I can fit it to NY NTP server but it look like a 
 headache to do it. 
  
  Do you have any idea how can it be done in most efficient way with the 
 NTP module provided by puppetlabs. 

 Several solutions: 

 1. write wrapper module per data center: 

 class ny_ntp { 
   class { ‘::ntp’: 
 server = [‘ny_ntp.corp.com’], 
   } 
 } 

 class sf_ntp { 
   class { ‘::ntp’: 
 servers = [‘sf_ntp.corp.com’], 
   } 
 } 

 class isr_ntp { 
   class { ‘::ntp’: 
servers = [‘isr_ntp.corp.com’], 
   } 
 } 

 use one of the the wrapper class within node classification 

 2. use hiera 

 provide a custom fact to identify location per server and put ntp::servers 
 into the appropriate hiera data hierarchy. 

 Best, 
 Martin 


  
  
  Thanks, 
  EddieM 
  
  -- 
  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...@googlegroups.com javascript:. 
  To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/8cdf1ae0-46c8-4de6-bb06-9f42bdbd31ed%40googlegroups.com.
  

  For more options, visit https://groups.google.com/d/optout. 



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d7398ad5-9b31-42e5-b3ee-d1eb889a8356%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Help with NTP module provided by puppetlabs

2015-08-09 Thread Martin Alfke
Hi Eddie,

On 09 Aug 2015, at 16:25, Eddie Mashayev eddie...@gmail.com wrote:

 Hi All, 
 
 I have many servers spread in 3 different time zones USA (NY and San 
 Francisco) and also in ISR. Have 3 NTP servers, one NTP server in each 
 location. 
 https://forge.puppetlabs.com/puppetlabs/ntp module is letting you to insert 
 an array of NTP servers 
 
 class { '::ntp': 
 servers = [ 'ntp1.corp.com', 'ntp2.corp.com' ], 
 } 
 
 I can override this array but the problem is how to fit the correct NTP 
 server to each server in the different location. 
 In other words, how can I modified the puppet module to fit server to the 
 correct NTP Server by locations. 
 
 For example - I thought using the server prefix name to choose the right NTP 
 server, for example if this server is located in NY so it prefix name is 
 ny-{server name} so I can fit it to NY NTP server but it look like a headache 
 to do it. 
 
 Do you have any idea how can it be done in most efficient way with the NTP 
 module provided by puppetlabs. 

Several solutions:

1. write wrapper module per data center:

class ny_ntp {
  class { ‘::ntp’:
server = [‘ny_ntp.corp.com’],
  }
}

class sf_ntp {
  class { ‘::ntp’:
servers = [‘sf_ntp.corp.com’],
  }
}

class isr_ntp {
  class { ‘::ntp’:
   servers = [‘isr_ntp.corp.com’],
  }
}

use one of the the wrapper class within node classification

2. use hiera

provide a custom fact to identify location per server and put ntp::servers into 
the appropriate hiera data hierarchy.

Best,
Martin


 
 
 Thanks,
 EddieM
 
 -- 
 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 view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/8cdf1ae0-46c8-4de6-bb06-9f42bdbd31ed%40googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/0CB6F615-A45C-408F-90B2-CCAEB9FCBC01%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Help with NTP module provided by puppetlabs

2015-08-09 Thread Eddie Mashayev
Hi All, 

I have many servers spread in 3 different time zones USA (NY and San 
Francisco) and also in ISR. Have 3 NTP servers, one NTP server in each 
location. 
https://forge.puppetlabs.com/puppetlabs/ntp module is letting you to insert 
an array of NTP servers 

class { '::ntp': 
servers = [ 'ntp1.corp.com', 'ntp2.corp.com' ], 
} 

I can override this array but the problem is how to fit the correct NTP 
server to each server in the different location. 
In other words, how can I modified the puppet module to fit server to the 
correct NTP Server by locations. 

For example - I thought using the server prefix name to choose the right 
NTP server, for example if this server is located in NY so it prefix name 
is *ny*-{server name} so I can fit it to NY NTP server but it look like a 
headache to do it. 

Do you have any idea how can it be done in most efficient way *with the NTP 
module provided by puppetlabs*. 


Thanks,
EddieM

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/8cdf1ae0-46c8-4de6-bb06-9f42bdbd31ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.