Re: [Puppet Users] Dynamic Nagios Hostgroup members via collected resources?

2014-01-15 Thread Nikola Petrov
On Tue, Jan 14, 2014 at 08:57:08AM -0800, smalderma wrote:
 Greetings All,
 
 I've referenced a few older discussions about nagios hostgroups and the 
 nagios_hostgroup resource.  I admit I'm somewhat new to this game, so 
 please excuse my ignorance on the complexities.  I'm looking for a way that 
 puppet can use collections / exported resources to create nagios host 
 groups.  For instance, I'd like a hostgroups for osfamilies, puppet 
 environments, domains, and perhaps virtual or hardware platform.
 
 It seems like using @@nagios_hostgroup on the nodes, and collecting the 
 resources on the Nagios server is not sufficient, when what I'm looking for 
 is one hostgroup named RedHat with members of this osfamily, and another 
 hostgroup named Solaris whose members are of the solaris osfamily.  I've 
 not had much success writing this into puppet, so is this just not 
 possible?  Would I be better served creating custom resource(s) that simply 
 collect lists of node names by the facts I'm interested and then the Nagios 
 server uses those collections as data to populate its set of 
 nagios_hostgroup resources?
 
 Thanks for your thoughts and wisdom.

I think that the only real way to do this properly is to not realize
nagios resources in the standard way. Check
https://github.com/dalen/puppet-puppetdbquery out and see if you can do
your nagios configuration with it. This is currently on my TODO list as
I am feeling the same pain(currently I am defining those in a big hiera
list...)

-- 
Nikola

 
 -- 
 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/3bf39a40-53c1-4de7-8e22-22ab45121927%40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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/20140115100640.GF3682%40nikolavp-desktop.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Help on Hiera automate

2014-01-15 Thread alessandro mazzoli
Thanks Jc,
i did what you said..i have changed .yaml like this:
  servers:
  s10:
sn: de3de
project: b
user: b
dbname: de
dbuser: e
dbpwd: de
  s16:
sn: de3dedede
project: b
user: a
dbname: de
dbuser: e
dbpwd: d
...
 and obtain params like this hiera('servers') and use create_resources 
function

Il giorno martedì 14 gennaio 2014 02:02:29 UTC+1, alessandro mazzoli ha 
scritto:

 Hi all,
 I'm trying to automate the set up of the machines staging,passing by an 
 php application ServerName , ProjectType,DbCredentials etc..(all strings) 
 and convert to yaml
 Here's my common.yaml:

 ---
 users:
   -sn: server.example.com
   -project : Symfony
   -dbname : test
   -dbuser  : test
   -dbpwd : test
   -sn: server2.example.com
   -project : Idephix
   -dbname : test
   -dbuser  : test
   -dbpwd : test

 Here's my hiera.yaml
 ---
 :backends:
-yaml
 :yaml:
   :datadir: '/etc/puppet/hieradata'
 :hierarchy:
   -common


 Is there any possibility on manifest to get all those variables by not 
 specifing the index as below ??
 $users=hiera('users')
 $sn0=$users[*0*]['sn']
 $sn1=
 ..
 ...

 I would like to preserve all the configurations if possible inside 
 common.yaml

 Thanks for the help





-- 
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/e0c04a5b-d0b0-4432-98fe-e916737c610d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Replace multiple expression with a variable in a selector

2014-01-15 Thread Andrey Kozichev
try $VARIABLE ='(host1|host2|host3)'
$testing = $::hostname ? {
/$VARIABLE/  = 'filetest',
default= 'file',
  }


On 15 January 2014 11:19, Francisco José Bejarano fjbejar...@gmail.comwrote:

 Greetings to all

 I have a question about the use of selectors. I am using 3.4.2

 I have this selector in my code

   $testing = $::hostname ? {
 /(host1|host2|host3)/  = 'filetest',
 default= 'file',
   }

 I would like to use a variable as a multiple expression in a selectorlike this

 $VARIABLE ='/(host1|host2|host3)/'

   $testing = $::hostname ? {
 $VARIABLE  = 'filetest',
 default= 'file',
   }

 ¿Is that possible?

 I've tried different ways but does not work. With quotes, without quotes,
 etc.. It always select the default file (file) if I put variable, but if I
 do not put variable (first code) it works ok and FileTest is used if
 hostname is in expression.

 I would like to use VARIABLE in hiera to use the name of hosts (not in
 hard code)

 ¿Is that possible?

 Thanks in advance :-)

  --
 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/5eecc840-5ab9-4636-a9be-492e8f65250c%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
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/CACzr%3DFfBKjFTXjYq7ODvGSPGJeqRgCbM6-S1W1g8RMAEYvJP4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Replace multiple expression with a variable in a selector

2014-01-15 Thread Francisco José Bejarano
Not runs

I have tried with all combinatios of quotes, arrays, hiera, etc. Only runs 
with literal values in the expression even I have replaced the selector 
with if statement

if $::hostname [ $variable ] {

and neither runs only with literal values

if $::hostname [ host1,host2,host3 ] {

If anyone knows how it is done...

El miércoles, 15 de enero de 2014 13:20:20 UTC+1, Andrew escribió:

 try $VARIABLE ='(host1|host2|host3)'
 $testing = $::hostname ? {
 /$VARIABLE/  = 'filetest',
 default= 'file',
   }


 On 15 January 2014 11:19, Francisco José Bejarano 
 fjbej...@gmail.comjavascript:
  wrote:

 Greetings to all

 I have a question about the use of selectors. I am using 3.4.2

 I have this selector in my code

   $testing = $::hostname ? {
 /(host1|host2|host3)/  = 'filetest',
 default= 'file',
   }

 I would like to use a variable as a multiple expression in a selectorlike 
 this

 $VARIABLE ='/(host1|host2|host3)/'

   $testing = $::hostname ? {
 $VARIABLE  = 'filetest',
 default= 'file',
   }

 ¿Is that possible?

 I've tried different ways but does not work. With quotes, without quotes, 
 etc.. It always select the default file (file) if I put variable, but if I 
 do not put variable (first code) it works ok and FileTest is used if 
 hostname is in expression.

 I would like to use VARIABLE in hiera to use the name of hosts (not in 
 hard code)

 ¿Is that possible?

 Thanks in advance :-)

  -- 
 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/5eecc840-5ab9-4636-a9be-492e8f65250c%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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/ec5a7ae1-3dce-42d6-863b-4c84da173305%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] nodejs - Running make returns 2 instead of 0

2014-01-15 Thread Björn
Hello,

I try to build nodejs, unfortunately by running of make via puppet it 
returns 2 somehow.
When I run make manually it returns 0 as expected.

puppet agent -t 
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/vmwaretools_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/pper_installed.rb
info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/os_maj_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/environment.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Caching catalog for pc
info: Applying configuration version '1389785537'
notice: /Stage[main]/Development-pc::Nodejs/Exec[git checkout]/returns: 
executed successfully
err: /Stage[main]/Development-pc::Nodejs/Exec[make nodejs]/returns: change 
from notrun to 0 failed: /usr/bin/make returned 2 instead of one of [0] at 
/etc/puppet/modules/development-pc/manifests/nodejs.pp:39
notice: /Stage[main]/Development-pc::Nodejs/Exec[make install nodejs]: 
Dependency Exec[make nodejs] has failures: true
warning: /Stage[main]/Development-pc::Nodejs/Exec[make install nodejs]: 
Skipping because of failed dependencies
notice: /Stage[main]/Development-pc::Nodejs/Exec[npm install grunt-cli]: 
Dependency Exec[make nodejs] has failures: true
warning: /Stage[main]/Development-pc::Nodejs/Exec[npm install grunt-cli]: 
Skipping because of failed dependencies
notice: Finished catalog run in 4.76 seconds

This is my exec:

  exec {'make nodejs':
command = /usr/bin/make,
creates = /usr/local/src/node/out/Release/node,
cwd = /usr/local/src/node,
path= [/usr/bin, /usr/sbin],
require = Exec['configure nodejs'],
  }

Do you got any idea? 

Thanks! 

Björn

-- 
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/8918fcca-4402-4c03-8148-0222e6735c89%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] nodejs - Running make returns 2 instead of 0

2014-01-15 Thread Ken Barber
 This is my exec:

   exec {'make nodejs':
 command = /usr/bin/make,
 creates = /usr/local/src/node/out/Release/node,
 cwd = /usr/local/src/node,
 path= [/usr/bin, /usr/sbin],
 require = Exec['configure nodejs'],
   }

 Do you got any idea?

Try adding the parameter logoutput = on_failure to the 'exec' and
re-run puppet. It should drop the output of the make command to the
log so you can see any errors that might have been occurring.

http://docs.puppetlabs.com/references/latest/type.html#exec-attribute-logoutput

ken.

-- 
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/CAE4bNTm6idWNxx3TS07X_0Du25CXmUvJK1HYt0VUtAghpo2%2BxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Replace multiple expression with a variable in a selector

2014-01-15 Thread Francisco José Bejarano
With this runs

hiera yaml

HOSTS_TESTING:
- 'host1'
- 'host2'
- 'host3'

and manifest

$HOSTS_TESTING = hiera_array('HOSTS_TESTING')

  if $::hostname in $HOSTS_TESTING {

$testing = 'filetest'
  } else {
  $testing = 'file'
  }



El miércoles, 15 de enero de 2014 14:11:09 UTC+1, Francisco José Bejarano 
escribió:

 Not runs

 I have tried with all combinatios of quotes, arrays, hiera, etc. Only runs 
 with literal values in the expression even I have replaced the selector 
 with if statement

 if $::hostname [ $variable ] {

 and neither runs only with literal values

 if $::hostname [ host1,host2,host3 ] {

 If anyone knows how it is done...

 El miércoles, 15 de enero de 2014 13:20:20 UTC+1, Andrew escribió:

 try $VARIABLE ='(host1|host2|host3)'
 $testing = $::hostname ? {
 /$VARIABLE/  = 'filetest',
 default= 'file',
   }


 On 15 January 2014 11:19, Francisco José Bejarano fjbej...@gmail.comwrote:

 Greetings to all

 I have a question about the use of selectors. I am using 3.4.2

 I have this selector in my code

   $testing = $::hostname ? {
 /(host1|host2|host3)/  = 'filetest',
 default= 'file',
   }

 I would like to use a variable as a multiple expression in a selectorlike 
 this

 $VARIABLE ='/(host1|host2|host3)/'

   $testing = $::hostname ? {
 $VARIABLE  = 'filetest',
 default= 'file',
   }

 ¿Is that possible?

 I've tried different ways but does not work. With quotes, without quotes
 , etc.. It always select the default file (file) if I put variable, but 
 if I do not put variable (first code) it works ok and FileTest is used 
 if hostname is in expression.

 I would like to use VARIABLE in hiera to use the name of hosts (not in 
 hard code)

 ¿Is that possible?

 Thanks in advance :-)

  -- 
 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/5eecc840-5ab9-4636-a9be-492e8f65250c%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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/f300c13d-ad8f-485b-9d13-eeb8d3099227%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Write a function to puupet

2014-01-15 Thread jcbollinger


On Wednesday, January 15, 2014 4:28:41 AM UTC-6, shlo@gmail.com wrote:



 Hi,
 I want to write a function for Puppet that check if package already 
 defined, I saw in this group to do:

 define safepackage ( $ensure = present ) {
 if !defined(Package[$title]) {
 package { $title: ensure = $ensure }
 }
 }

 In which file I need put this function so all other modules can access 
 it?  because I'm getting 'unknown function...' error.


That's not a function, it's a defined type.  You declare instances just as 
you would declare instances of a built-in type, such as Package itself.  
You cannot call it as if it were a function.  You really ought to put it 
into a module, though.

With that said, what you propose to do is one of the persistent bad ideas 
in the Puppet universe.  Using such a definition to allow multiple points 
of declaration of a given resource (only one of which will be effective) 
makes your manifest set harder to maintain and opens it to subtle bugs 
because you must keep all declarations of the target resource 
synchronized.  If you don't, then your manifest set thereby has an internal 
inconsistency that you prevent Puppet from diagnosing.  All manner of 
strangeness may then ensue.  Moreover, the approach is only effective for a 
given resource if you apply it to every declaration of that resource.

The best way to avoid multiple-declaration errors is to factor out multiple 
declarations of any given resource into a single class that the other 
erstwhile declaration points will rely on.  That is usually fairly 
natural.  It may involve modifying third-party modules, but so does any 
approach based on the defined() function or similar.


John

-- 
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/cd5166e6-347f-495c-b14e-62ab417e0774%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] nodejs - Running make returns 2 instead of 0

2014-01-15 Thread Björn Becker
Ohhh, you made my day. That shows the problem. 
We need /bin in PATH for uname. 

Thanks a lot! 

Björn

Am Mittwoch, 15. Januar 2014 14:39:54 UTC+1 schrieb Ken Barber:

  This is my exec: 
  
exec {'make nodejs': 
  command = /usr/bin/make, 
  creates = /usr/local/src/node/out/Release/node, 
  cwd = /usr/local/src/node, 
  path= [/usr/bin, /usr/sbin], 
  require = Exec['configure nodejs'], 
} 
  
  Do you got any idea? 

 Try adding the parameter logoutput = on_failure to the 'exec' and 
 re-run puppet. It should drop the output of the make command to the 
 log so you can see any errors that might have been occurring. 


 http://docs.puppetlabs.com/references/latest/type.html#exec-attribute-logoutput
  

 ken. 


-- 
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/94f5-911f-48ed-9174-bbbaca1a7715%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Replace multiple expression with a variable in a selector

2014-01-15 Thread Felix Frank
General remark: You should use hiera() to retrieve that value.
hiera_array() is only useful in very specific situations, and only if
you have a non-trivial hierarchy.

On 01/15/2014 03:02 PM, Francisco José Bejarano wrote:
 
 HOSTS_TESTING:
 - 'host1'
 - 'host2'
 - 'host3'
 
 and manifest
 
 $HOSTS_TESTING = hiera_array('HOSTS_TESTING')

-- 
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/52D69CCA.2020200%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: Puppet calls the ENC twice for some nodes.

2014-01-15 Thread jcbollinger


On Tuesday, January 14, 2014 5:20:55 PM UTC-6, James Ellis wrote:

 Hi, chanced across this discussion when I noticed an ENC was being called 
 twice. I understand I may not be using the ENC terminus exactly as it's 
 been designed, but it's unexpected that it was called twice. Also worth 
 noting that I can't see a note about the ENC being called twice here: 
 http://docs.puppetlabs.com/guides/external_nodes.htmlhttp://www.google.com/url?q=http%3A%2F%2Fdocs.puppetlabs.com%2Fguides%2Fexternal_nodes.htmlsa=Dsntz=1usg=AFQjCNFK7HQpajIuPvlZjm7asakMiSwElg



True, but the docs also don't say it's called only once.  If you read 
between the lines, you might infer that it can be called multiple times.  
In particular, consider this excerpt from the doc: In Puppet 3 and later, 
ENCs can set an environment for a node, overriding whatever environment the 
node requested. However, previous versions of Puppet use ENC-set and 
node-set environments inconsistently, with the ENC’s used during catalog 
compilation and the node’s used when downloading files.  The reason for 
the inconsistency in Puppet 2 is that file downloads occur in separate 
request contexts, and that version of Puppet did not re-run the ENC for 
each of those as it would have needed to do to compute the appropriate 
environment correctly.

To be sure, the docs could be clearer on the point.  Feel free to file an 
RFE.

 

 In my case, I'm using an ENC to push virtual host changes to an agent 
 running a web server, the YAML returned by the ENC uses create_resources to 
 dynamically add resources to the catalogue.
 I observed via logging in the ENC script that on the first run, the ENC 
 was excecuted but the catalogue was not applied, on the second run the 
 catalogue was applied on the agent.



By default, the agent issues at least two web requests to the master on 
every run because it first synchronizes plugins, then requests a catalog.  
It may make other requests as well, to retrieve plugin contents when it 
determines those are needed, or to retrieve 'source'd files.  All of those 
requests require the master to determine the node's environment to provide 
correct service, and determining the environment requires running the ENC, 
if there is one.

 

 This causes problems where we use an API to dynamically apply resources to 
 a catalogue (1st run gets the catalogue resources, returns 'OK' to the API, 
 2nd run then tries to get resources but gets nothing as the 'OK'  sent to 
 the API has effectively modified the resources to be applied).

 I've worked around this, for now, by using a lock file, so that the 'OK' 
 API call is only run once but this still applies two calls to the API to 
 dynamically get resources for the catalogue, where only one is required. I 
 double checked the master and the agent configs, and the master only shows 
 the ENC being referenced once and there is one  agent being run, only.

 Based on this, is there any way the agent can be set to call the ENC once 
 only ? The only argument to the script is the agent hostname and there is 
 no apparent difference in the environment of the first and second ENC calls.



If you disable pluginsync at the agent and avoid declaring any 'source'd 
File resources pointing back to the master, then I think the agent will 
make only one request to the master per catalog run.  In that case, the 
master should run the ENC only once for that catalog run.

Disabling pluginsync may make it difficult to insert certain new modules 
into your Puppet infrastructure or to update such modules, and avoiding 
'source'd Files will require great discipline and vigilance.  I would think 
twice before going that route.  Instead, if you want to stick with your 
current ENC concept then you should consider how your ENC might recognize 
multiple calls associated with the same catalog run.

I think node facts are updated only once per catalog run, after pluginsync 
and just prior to running the ENC to kick off catalog compilation.  
Perhaps, then, you could watch each node's 'uptime_seconds' fact, and 
perform your once-per-catalog-run work only if the value of that fact is 
different from what it was during the previous run of the ENC for the given 
node.  The doc you referred to has a bit of information about how the ENC 
can access node facts.


John

-- 
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/b49829d1-e452-41b6-9fa2-9dd0fc4e1fd8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] hiera

2014-01-15 Thread Peter Romfeld
Hi,

I just started learning puppet a few days ago.. I finished eBook Pro
Puppet all the puppet e-courses and read quite a bunch about roles and so
on...

What i have not found so far is a Hiera tutorial I understand, i read
through puppetlabs docu but i dont understand it. Maybe i should just start
without hiera and after some useage it get clear to me..
But maybe there is a hiera tutorial for noobs?

Cheers,
your just-started-puppet-noob

-- 
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/CAKiz-Ne%3DKRZxJxTh1zUp2Pg55iyQnHJJQLhbfx6Ke%2BTsgpcxqw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: Nagios_contact in multiple contactgroups

2014-01-15 Thread Jonathan Gazeley

On 14/01/14 23:27, jcbollinger wrote:



On Tuesday, January 14, 2014 5:42:54 AM UTC-6, Jonathan Gazeley wrote:

This is ridiculous and bizarre behaviour and seems to defy the
whole point of having a managed resource, and there is an old,
open bug for it.

http://projects.puppetlabs.com/issues/4020
http://projects.puppetlabs.com/issues/4020



I think ridiculous and bizarre is a bit strong.  It's strange that 
the type selects one element and ignores the rest, but it's not so 
surprising that's what's wanted in the first place is whatever string 
is supposed to be plugged in to the corresponding hole in the Nagios 
config file.  That's even a viable way to read the documentation for 
the type.  And I certainly don't understand what any of this has to do 
with the whole point of having a managed resource.


John,

I'm sorry for my outburst yesterday - quite embarrassed to read my 
message back again :\ I was just a bit frustrated to run into bugs 
and/or unexpected behaviour when I also had some of our dev/ops guys on 
my back wondering when I was going to fix their monitoring notifications.


Hulk smash, Hulk do Nagios configs!

I think what I meant was - data structures within Puppet and Hiera are 
almost always handled as arrays or hashes, and when you call upon other 
classes and resources you would tend to pass it an array or a hash. I 
was surprised that this isn't the case for nagios_* types, which expect 
a comma-delimited format.




There's a workaround using templates as a filthy hack:

# manifest.pp
nagios_host { $fqdn:
  address = $ipaddress,
  hostgroups = template(join_hostgroups.erb)
}



You seem angry about this.  I don't understand why.


Yeah, today I'm not sure why either. I guess it seems a less elegant 
solution (and potentially more expensive in terms of resources on an 
already busy puppetmaster). It's the first time I've had to do something 
like this (I guess that makes me lucky).




Anyway, if you have Puppetlabs's stdlib add-in module installed, 
then it provides a join() function that can replace the template.  Or 
at minimum it would probably be better to use an inline_template() 
instead of an external one.


After my email yesterday, I changed my approach to use an 
inline_template() which works nicely. Also good to know that there's a 
join() function for for joining arrays - thanks for the tip. We do 
already have stdlib installed, but only as a dependency for other 
forge modules - I've never called upon its functions myself. Thanks for 
the tip - I'll check it out tomorrow (now after 4pm here and we're not 
allowed to make changes in case we break stuff!)


Sorry again for my rage, and thanks for your advice. If you're ever in 
Bristol (UK), I'll buy you a pint :)


Cheers,
Jonathan

--
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/52D6B40C.5080909%40bristol.ac.uk.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Doubt about lots of persistent connections

2014-01-15 Thread Dick Davies
Those connections don't take much in the way of resources on the ActiveMQ server
(you might need to up the number of open files the activemq process is
able to access).

I'm not sure what you mean about non-persistent connections; are you
talking about
agents periodically connecting to check? i'd expect the continual
connection setup/teardown
to put more load on the MQ server that 1000 or so idle connections
(with maybe the occasional
keepalive). STOMP is pretty lightweight.

On 15 January 2014 11:17, Dani Gutiérrez Porset jdani...@gmail.com wrote:
 Hi community,
 in a testing PE installation I see each agent maintains a persistent
 collection to ActiveMQ process in master server, to be used by mcollective
 in a push (vs pull) scheme.

 As it's not so sure that one master is sending lots of petitions to agents,
 which are the advantages of this schema instead of non-persistent
 connections, specially for the case that there are lots of agents? (well,
 maybe this is a question more for ActiveMQ than Puppet, but...)

 Could anyone tell about the hardware (mainly RAM) for the master server
 (with ActiveMQ) supporting 500 or 1000 Puppet agents?

   Thanks a lot in advance

 --
 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/60dea08d-fc3f-4da1-aae2-06ef528fa07a%40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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/CAK5eLPTQByMYmC%2B9T%2BX0C2iqzu3F5f0FMZ9YyujO6x7aAuVBfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Have An Issue To Report, But Can't Figure Out How

2014-01-15 Thread Lauren R
Hello from your neighborhood Docs team! We've updated the headers, and the 
bug tracker links should point to JIRA now. Apologies for missing that in 
the first go-round. 

All the best, 
Lauren

On Monday, January 13, 2014 10:22:07 AM UTC-8, Paul Nickerson wrote:

 I have an issue to report in the Puppet Community Package 
 Repositoryhttp://projects.puppetlabs.com/projects/puppet-community-pkg-repo,
  
 but I don't how to do so. The Puppet Labs issue tracker and project 
 directory home page http://projects.puppetlabs.com/ says After 
 choosing a project, use its “Issues” and “New Issue” tabs to search 
 existing bugs and report new ones. To log new issues, you will need to 
 register a user account and sign in. However, I have created an account 
 and am signed in, but I see no New Issue tab.

 Does anyone know how an issue should be reported?

 The issue I'd like to report, BTW, is that the Puppet Windows binary 
 package http://downloads.puppetlabs.com/windows/puppet-3.4.2.msiincludes 
 ruby.exe version 1.9.3.448, which according to the Common 
 Vulnerabilities and Exposures List has vulnerability 
 CVE-2013-4164http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4164
 .


-- 
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/9f338639-b90f-47f9-8fd4-3d98fa881f23%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] puppet ERROR 400

2014-01-15 Thread Vassiliy Vins
Hi!

I've created 2 files:

file *test.pp* with code :

class copy {

file {testfile:
path = /home/vassiliy/myfile,
source = puppet:///mpoint/client1/testfile,
mode = '644'
}
}

and file site.pp wuth code:

import test.pp

node client1 {
include copy
}

in fileserver.conf was created section like:

[mpoint]

path /etc/puppet/files
allow *

file *testfile* is in folder /etc/puppet/files/client1/

I got on client1/var/log/messages  next:

ERROR 400 on SERVER: Not authorized to call find on 
/file_metadata/client1/testfile with {:links = manage}

Any ideas, why? where to look at? thnx

-- 
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/eecbeecc-ff52-40f5-9af5-abe3eae5aba6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Submit a Talk for PuppetConf 2014

2014-01-15 Thread Dawn Foster
I wanted to let everyone know that we have opened up the CFP for
PuppetConf 2014. Submissions are due by midnight PDT on March 18,
2014.

All of the details can be found here:
http://puppetlabs.com/blog/submit-talk-puppetconf-2014

Here are a few examples of what we would like to see:
* Introductory topics for getting started with Puppet, modules, or
other technologies.
* Tips and tricks for using Puppet, MCollective, PuppetDB, Razor,
Hiera, Facter, etc.
* Case studies with details about how you use Puppet in your
environment: what worked, what didn't.
* Deploying and using Puppet at enterprise scale.
* Using Puppet to manage Windows.
* Using Puppet to solve problems related to release management,
continuous delivery, application release automation, change control
and similar processes.
* Interesting new technologies and how they can be used with Puppet.
* Related technologies, like Vagrant, Docker and Logstash, and using
them with Puppet.
* Using Puppet in the cloud with OpenStack, AWS, Rackspace, Eucalyptus etc.
* Using Puppet with virtualization software, like VMware, Hyper-V,
KVM, Citrix/Xen, etc.
* Using Puppet to automate network and/or storage infrastructure
together with compute infrastructure (avoiding silos with
software-defined infrastructure).
* Advanced Puppet topics and using the related technologies in new and
interesting ways.
* DevOps culture, process and tools along with how to make working in
operations a better experience.

The direct link to the CFP form:
https://docs.google.com/spreadsheet/viewform?formkey=dEVOeUdUOW9HeHpFekc4eDI4SUx4QUE6MA

Thanks,
Dawn Foster
Director of Community
http://puppetlabs.com/community

-- 
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/CAPUeXZqBe2Pp%3DuiNYMQiL895trQ0FRU-iGHJhqVY3xuZg%2B819w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Using Virtual Resources and create_resource combination

2014-01-15 Thread CD
Hi friends,

I have an issue where that I receive error Error 400 on SERVER: Cannot 
reassign variable name on node app1. When I run the agent on admin1 it 
works fine, but when I run the agent on app1 it give me the error.

Having read few forum posts it seems this is most likely that the same 
resource is used. resource network::if::static is used with eth0 in the 
same class when it runs for admin1 and app1. I believe when it run on 
admin1 variables are used without any problem and when it run on app1 it 
find the variable has been used for admin1. It appears these kind of issues 
are addressed by creating virtual resources. However I cannot figure out 
how I can define virtual resources and combine that with create_resources. 
I need to use the create_resources because I was to pass the hieradata to 
the resource.

*Any ideas how I can address this problem?*

Details of the implementation given below:

I have following hieradata which applied to each server:

/etc/puppet/hieradata/admin1.json
{
   networks:{
  eth0:{
 ipaddress:192.168.1.1,
 netmask:255.255.255.0
  }
   }
}

/etc/puppet/hieradata/app1.json
{
   networks:{
  eth0:{
 ipaddress:192.168.1.2,
 netmask:255.255.255.0
  }
   }
}

I have a class call foundation and it has following files
/etc/puppet/modules/foundation/manifests/init.pp
class foundation {
include foundation::network
}

/etc/puppet/modules/foundation/manifests/network.pp
class foundation::network{

# Defaults for network configuration
$nic_default = {
'ensure' = 'up'
}

# Extract Data from Hiera for the host in concern
$nics   = hiera(networks,{})

# Configure networks based on the parameters
create_resources(network::if::static, $nics, $nic_default)

}

Above class is included in base node and individual nodes has extended from 
the base node
/etc/puppet/manifests/nodes.pp
node base {
   include foundation
}

node admin1 inherits base {
}

node app1 inherits base {
}

Thanks,
CD

-- 
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/23a6858d-6a4c-4d71-95fa-524867c56f2a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] ssh module dependency failure

2014-01-15 Thread Tim Dunphy
Hi All,


I'm writing to you today because I am attempting to follow along in the
Pro Puppet book I am attempting the ssh module example from page 39.

I am getting the following error on the client when I try to implement it:

[root@beta:~] #puppet agent --test --server puppet.mydomain.com
info: Caching catalog for beta.mydomain.com
err: Failed to apply catalog: Could not find dependency Class[Ssh:install]
for File[/etc/ssh/sshd_config] at
/etc/puppet/modules/ssh/manifests/init.pp:16

This is the class I have defined on the puppet server:

class ssh::install {
   package { openssh:
 ensure = present,
   }
}

class ssh::config {
file { /etc/ssh/sshd_config:
  ensure = present,
  owner = 'root',
  group = 'root',
  mode = 0600,
  source = puppet:///modules/ssh/sshd_config,
  require = Class[ssh:install],
  notify = Class[ssh::service],
 }
}

class ssh::service {
   service { sshd:
   ensure = running,
   hasstatus = true,
   hasrestart = true,
   require = Class[ssh::config],
 }
}

class ssh {
include ssh::install, ssh::config, ssh::service
   }


And this is the definition I tried to copy from the book:


class ssh::install {

 package { openssh:

ensure = present,

  }

  }


  class ssh::config {

   file { /etc/ssh/sshd_config:

 ensure =  present,

 owner = 'root',

 group = 'root',

 mode = 0600,

 source = puppet:///modules/ssh/sshd_config,

 require = Class[ssh::install],

 notify = Class[ssh::service],

  }

   }



class ssh::service {

 service { sshd:

 ensure = running,

 hasstatus = true,

 hasrestart = true,

 enable = true,

 require = Class[ssh::config],

 }

   }


class ssh {   include ssh::install, ssh::config, ssh::service }



However I can't tell what the differences are that prevent the version I
keyed in from working. I've even created a diff of the two files with the
same order of files that you see above (mine first , theirs second)



[root@beta:~] #cat ssh_diff.txt

1,5c1,5

 class ssh::install {

package { openssh:

  ensure = present,

}

 }

---

 class ssh::install {

  package { openssh:

 ensure = present,

   }

   }

7,17c7,17

 class ssh::config {

 file { /etc/ssh/sshd_config:

   ensure = present,

   owner = 'root',

   group = 'root',

   mode = 0600,

   source = puppet:///modules/ssh/sshd_config,

   require = Class[ssh:install],

   notify = Class[ssh::service],

  }

 }

---

   class ssh::config {

file { /etc/ssh/sshd_config:

  ensure =  present,

  owner = 'root',

  group = 'root',

  mode = 0600,

  source = puppet:///modules/ssh/sshd_config,

  require = Class[ssh::install],

  notify = Class[ssh::service],

   }

}

19,26d18

 class ssh::service {

service { sshd:

ensure = running,

hasstatus = true,

hasrestart = true,

require = Class[ssh::config],

  }

 }

28c20,30

 class ssh { include ssh::install, ssh::config, ssh::service }

---

 class ssh::service {

  service { sshd:

  ensure = running,

  hasstatus = true,

  hasrestart = true,

  enable = true,

  require = Class[ssh::config],

  }

}



 class ssh {   include ssh::install, ssh::config, ssh::service }



 Could I possibly borrow a fresh pair of eyeballs that might be able to
recognize what's wrong?


Thanks



-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

-- 
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/CAOZy0emB1akVKkMv8S5gmtBs_0fatv0E%3DApvh65KhU%3DFtzKxnA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: Puppet calls the ENC twice for some nodes.

2014-01-15 Thread James Ellis
Thanks Jason for the info.

Bear with me, but I'm still unsure why the ENC would run twice, 
particularly given the dynamic nature of an ENC terminus where it would be 
connecting to other systems to get information for a catalogue -- those 
systems are then hit twice, regardless of whether or not the same 
information is returned, which seems a waste of resources (e.g maybe the 
external system has a quota limit ?)
I see in our logs running twice when the agent, in verbose mode, outputs 
Info: retrieving plugin and then another run when it outputs  Info: 
Caching catalog for ...

In relation to applying changes to a virtual hosting setup, I'll look at 
other options. Given a quick example of say a domain  'enc.example.com' 
being created, then the customer fails to pay for their domain or hosts 
elsewhere, such that it should be deleted, the ENC should then provide this 
account for deletion in the catalogue, so that it is removed on the 
relevant server. I understand that this is changing the catalogue 
information across ENC runs but how else would this change be provided to 
the agent ?

Regards
James


On Wednesday, 15 January 2014 12:40:39 UTC+11, Jason Antman wrote:

  James,

 I vaguely remember seeing this 'node_terminus called twice' thing in the 
 past. The simple answer, though I know it's not what people want to hear, 
 is that the ENC should always return the right information. If you want to 
 modify the content of the catalog based on something that happens between 
 runs (which, by the way, I would highly suggest against, and suggest that 
 if you're doing that, something in your puppet configuration is amiss), you 
 should be checking somewhere like PuppetDB, not changing it based on how 
 many times the ENC script is run. Aside from the problem you're having now, 
 what happens if there's a timeout, or some other failure after the ENC 
 script is called but before the catalog is applied?

 -Jason

 On 01/14/2014 06:20 PM, James Ellis wrote:
  
  Hi, chanced across this discussion when I noticed an ENC was being 
 called twice. I understand I may not be using the ENC terminus exactly as 
 it's been designed, but it's unexpected that it was called twice. Also 
 worth noting that I can't see a note about the ENC being called twice here: 
 http://docs.puppetlabs.com/guides/external_nodes.html 

  In my case, I'm using an ENC to push virtual host changes to an agent 
 running a web server, the YAML returned by the ENC uses create_resources to 
 dynamically add resources to the catalogue.
 I observed via logging in the ENC script that on the first run, the ENC 
 was excecuted but the catalogue was not applied, on the second run the 
 catalogue was applied on the agent.
  This causes problems where we use an API to dynamically apply resources 
 to a catalogue (1st run gets the catalogue resources, returns 'OK' to the 
 API, 2nd run then tries to get resources but gets nothing as the 'OK'  sent 
 to the API has effectively modified the resources to be applied).
  
  I've worked around this, for now, by using a lock file, so that the 'OK' 
 API call is only run once but this still applies two calls to the API to 
 dynamically get resources for the catalogue, where only one is required. I 
 double checked the master and the agent configs, and the master only shows 
 the ENC being referenced once and there is one  agent being run, only.

  Based on this, is there any way the agent can be set to call the ENC 
 once only ? The only argument to the script is the agent hostname and there 
 is no apparent difference in the environment of the first and second ENC 
 calls.

  Using 3.4 O/S on ubuntu with the following agent command (run as root 
 manually to debug) :
 puppet agent --no-usecacheonfailure --onetime --no-daemonize --server 
 valid.server --verbose

  
  Thanks
 James
  

 On Monday, 23 September 2013 23:59:45 UTC+10, jcbollinger wrote: 



 On Friday, September 20, 2013 12:05:17 PM UTC-5, Greg Sutcliffe wrote: 

 Is this puppet3? As I recall, in puppet3, the master makes a separate 
 call to the enc to determine the environment the should authoritatively be 
 in. Once that's established, it makes a second call to get the classes and 
 parameters.


 Not exactly, but that may well be the right track.  It would be pointless 
 for the master to run the ENC more than once for catalog compilation, for 
 it would have no reason to expect that the ENC's output would change.  
 HOWEVER, the master's file server may need to run the ENC again to 
 determine the environment from which to serve 'source'd files.


 John

   -- 
 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/373455ff-43f4-4f27-8667-ab896c240ea6%40googlegroups.com
 .
 

[Puppet Users] Re: Using Virtual Resources and create_resource combination

2014-01-15 Thread CD
ok I found a workaround to my problem. I updated the network module 
(https://forge.puppetlabs.com/razorsedge/network) so that it is now 
accepting a label as the name rather than interface (eth0 etc). In this way 
I can provide a unique name and get away with assigning same name leading 
to error. then I introduced a new parameter to module to accept interface. 
For example my data now updated as follows.

/etc/puppet/hieradata/admin1.json
{
   networks:{
  admin1-admin:{
 interface:eth0,
 ipaddress:192.168.1.1,
 netmask:255.255.255.0
  }
   }
}

But I still like to know is it possible to use the create_resources and 
virtual resources together where I need to pass hieradata also.

Thanks,
CD

On Thursday, January 16, 2014 1:57:41 PM UTC+10, CD wrote:

 Hi friends,

 I have an issue where that I receive error Error 400 on SERVER: Cannot 
 reassign variable name on node app1. When I run the agent on admin1 it 
 works fine, but when I run the agent on app1 it give me the error.

 Having read few forum posts it seems this is most likely that the same 
 resource is used. resource network::if::static is used with eth0 in the 
 same class when it runs for admin1 and app1. I believe when it run on 
 admin1 variables are used without any problem and when it run on app1 it 
 find the variable has been used for admin1. It appears these kind of issues 
 are addressed by creating virtual resources. However I cannot figure out 
 how I can define virtual resources and combine that with create_resources. 
 I need to use the create_resources because I was to pass the hieradata to 
 the resource.

 *Any ideas how I can address this problem?*

 Details of the implementation given below:

 I have following hieradata which applied to each server:

 /etc/puppet/hieradata/admin1.json
 {
networks:{
   eth0:{
  ipaddress:192.168.1.1,
  netmask:255.255.255.0
   }
}
 }

 /etc/puppet/hieradata/app1.json
 {
networks:{
   eth0:{
  ipaddress:192.168.1.2,
  netmask:255.255.255.0
   }
}
 }

 I have a class call foundation and it has following files
 /etc/puppet/modules/foundation/manifests/init.pp
 class foundation {
 include foundation::network
 }

 /etc/puppet/modules/foundation/manifests/network.pp
 class foundation::network{

 # Defaults for network configuration
 $nic_default = {
 'ensure' = 'up'
 }

 # Extract Data from Hiera for the host in concern
 $nics   = hiera(networks,{})

 # Configure networks based on the parameters
 create_resources(network::if::static, $nics, $nic_default)

 }

 Above class is included in base node and individual nodes has extended 
 from the base node
 /etc/puppet/manifests/nodes.pp
 node base {
include foundation
 }

 node admin1 inherits base {
 }

 node app1 inherits base {
 }

 Thanks,
 CD



-- 
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/230210ae-163d-462b-a36a-4f0503be9ccc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.