[Puppet Users] Re: IS it possible to generate dynamically the configuration of a node ?

2016-03-03 Thread Martin Rodriguez

>
> Thanks a lot for all your help !!! 
>

Do you some websites that gives java examples ? 

-- 
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/6fd8c9da-987b-4e8a-a405-fe06ba5bd500%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Usage of aws module from resource abstraction layer

2016-03-03 Thread Sergey Zemlyanoy


Hey folks,

How you guys maintain your ec2 instances using aws module from command 
line? I intend to rely on RAL or mco to be able to provision instances on 
demand, without declaring them in puppet/hiera, but just take defaults from 
there. I want to let my build server to execute command like:

puppet resource ec2_instance  ensure=present =

so it could take defaults(ami, region etc) from hiera and kick few build 
instances with unique hostnames.

I faced with some issues here: not all params can be passed to RAL, namely 
user*_data, block*devices


puppet resource ec2*instance someinstance ensure=present 
region=eu-central-1 image*id=x security*groups='x' subnet=x 
instance*type=m3.medium block*devices=[{'delete*on*termination':'true', 
'volume*size':10, 'device*name':'/dev/sda'}] Error: Could not run: Invalid 
parameter setting volume*size:10,


seems its not possible to pass hash to 'puppet resource' either.

Any thoughts on how can I pass these attributes or how to force usage of 
defaults from hiera?

Much appreciated, Sergey

-- 
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/5e530737-2231-489c-b5e1-1f8f480ff772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppet.conf documentation

2016-03-03 Thread Matt Zagrabelny
Greetings,

I know that the puppet.conf documentation exists in extreme detail:

http://docs.puppetlabs.com/puppet/3.7/reference/configuration.html

What that page doesn't tell me is if the config items map to the
[agent] or [master] sections of the config file.

Does anyone know if that data exists in an easy to consume location?

On my puppet master system I have the following puppet.conf snippet:

[main]
logdir   = /var/log/puppet
vardir   = /var/lib/puppet
ssldir   = /var/lib/puppet/ssl
rundir   = /var/run/puppet
factpath = $vardir/lib/facter
dns_alt_names= puppet-3-7,puppet-3-7.d.umn.edu
stringify_facts  = false
ordering = manifest
environmentpath  = $confdir/environments
basemodulepath   =
$confdir/modules:$confdir/profiles:/usr/share/puppet/modules

Should I also have the same configs on my clients?

For instance, should stringify_facts be set on the clients?

Thanks for any help!

-m

-- 
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/CAOLfK3UdKoBuApY8XNsztWQqNRKGJER3LWj9QVJLF-EWdA6FCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Module parameter handling

2016-03-03 Thread Henrik Lindberg

On 02/03/16 11:26, Thomas Bendler wrote:

Hi @all,

I write a module that create local users on my boxes. Now I try to make
that module fully dynamic so that the user informations are passed to
the module as parameter like this:

class { 'local_users':
   user => [
 { 'john' => { name => 'John Doe', home => '/export/home/john' } },
 { 'jane' => { name => 'Jane Doe', home => '/export/home/jane' } }
   ]
}

You could use a hash there directly instead of an array of hashes. The 
'id' (e.g. 'john', 'jane' has to be unique anyway.



So far, so good. But now I would like to iterate through the user array
and create the user resource and I have no clue how this should be done
correctly. My approach is to call a define:

local_users::config::account { $local_users::user }

Which look like this:

define local_users::config::account (
   $id   = $title,
   $name = undef,
   $home = undef
) {
   user { $id:
 ensure => present,
   comment=> $name,
   home   => $home,
   managehome => true,
   password   => '!!';
   }
}

I guess the direction should be understandable, I would like to specify
the users and their attributes as a parameter. What I don't get so far
is, do I need one resource definition for each possible combination or
is there a way that only the parameter that contain values are used
within the resource type? Is the path in general the correct one that I
use or is there a better approach to get this done?



If you are on 3.x with future parser, or on 4.x you can iterate.

I made some simplifications here, everything is one hash, and
I renamed 'name' to 'comment' so I could use the hash directly
to set all attributes without having to first transform 'name'
into 'comment'.

class { 'local_users':
  user => {
'john' => { comment => 'John Doe', home => '/export/home/john' },
'jane' => { comment => 'Jane Doe', home => '/export/home/jane' }
  }
}

class local_users($users) {
  $users.each |$id, $attributes | {
user { $id:
  managehome => true,
  password   => '!!',
  *  => $attributes  # attributes from hash
}
  }
}

With typed parameter


To make it more robust you can also type the $users argument

class local_users(
  Hash[String, Struct[{
name => String,
home => String}]
  ] $users)
{
  $users.each |$id, $attributes | {
user { $id:
  managehome => true,
  password => '!!',
  * => $attributes
}
  }
}

Hope that helps.

Regards
- henrik

--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/56D88274.2010101%40puppetlabs.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] validate_bool() throwing in error syaing the value not a boolean

2016-03-03 Thread Henrik Lindberg

On 03/03/16 17:46, Trevor Vaughan wrote:

You can try using the hiera command line tool on your hiera.yaml file.

hiera -c '/path/to/hiera.yaml' your::variable.



If you are on a newer puppet version where the lookup command is 
available you can use 'puppet lookup --explain your::variable'

as it will tell you how it searched for the value.

- henrik


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/56D87E05.4060501%40puppetlabs.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Avoiding duplicate exported resource

2016-03-03 Thread Ken Barber
Exported resources won't handle any resource de-duplication. You can
get around this by simply not using that to collect data, dalen's
puppetdb-query will help with this, and in PDB 4.0 we're introducing a
function for this purpose also into core. Once you have the data, then
you can do anything with it, using Puppet's latest iterator support
this should become easier also, as you can reduce the results.

As you mention, the other option is to put your proxied/external
address test, somewhere else, in one place - like on the nagios
machine itself or something like that. Then its not a duplicate. Model
wise, it probably doesn't belong on _all_ your nodes like you say, but
then again it shouldn't belong to one of the cluster nodes either,
later on if you remove that node it all stops working.

Model wise, in an ideal world, the proxied/virtual address would be a
'node' of sorts, and have that entry, but if no box exists to compile
that catalog, well then we're just talking crazy :-).

Whatever you're solution, the problem will repeat itself if you have
other virtual addresses, I'd make sure you're happy with whatever
solution for multiple clusters, at least then you have continuity,
people will know where to go to do look into problems etc.

ken.



On Thu, Mar 3, 2016 at 5:11 PM, Daniel Urist  wrote:
> I've created a module to configure a caching nginx proxy. I am running
> several of these proxies behind a load balancer. They all proxy the same
> external address. I'd like to export a nagios host/service for monitoring
> the external address, which will then be collected on my nagios server. The
> problem is, since I have several instances of the proxy managed by puppet,
> and the exported host/service is identical on each, I end up with duplicate
> resources. I could give the resources unique names (e.g. by appending the
> proxy's hostname to the resource name), but then I end up with multiple
> identical hosts/services in nagios, which doesn't work.
>
> The puppet stdlib module has an "ensure_resource" function, but there
> doesn't seem to be a way to use this on an exported resource collector.
>
> I guess one workaround would be to set a parameter in the proxy module, for
> example "export_address" and have that default to "false", and only set it
> to "true" for one node, but that's kind of ugly since one node then needs to
> be special.
>
> Surely this isn't an uncommon use case-- what's the best way to work around
> this?
>
>
> --
> 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/CAEo6%3DKbwrCYz3ovqo-E0u7EH-Jep%2BwrxEW3FhV1v8-G%3DRr%2B80w%40mail.gmail.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/CAE4bNTmjYc-MO4mnUmKGyv9cLSg0hpP%2BtwHOgyWSLqa-i1OpFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Avoiding duplicate exported resource

2016-03-03 Thread Daniel Urist
I've created a module to configure a caching nginx proxy. I am running
several of these proxies behind a load balancer. They all proxy the same
external address. I'd like to export a nagios host/service for monitoring
the external address, which will then be collected on my nagios server. The
problem is, since I have several instances of the proxy managed by puppet,
and the exported host/service is identical on each, I end up with duplicate
resources. I could give the resources unique names (e.g. by appending the
proxy's hostname to the resource name), but then I end up with multiple
identical hosts/services in nagios, which doesn't work.

The puppet stdlib module has an "ensure_resource" function, but there
doesn't seem to be a way to use this on an exported resource collector.

I guess one workaround would be to set a parameter in the proxy module, for
example "export_address" and have that default to "false", and only set it
to "true" for one node, but that's kind of ugly since one node then needs
to be special.

Surely this isn't an uncommon use case-- what's the best way to work around
this?

-- 
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/CAEo6%3DKbwrCYz3ovqo-E0u7EH-Jep%2BwrxEW3FhV1v8-G%3DRr%2B80w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] validate_bool() throwing in error syaing the value not a boolean

2016-03-03 Thread Trevor Vaughan
You can try using the hiera command line tool on your hiera.yaml file.

hiera -c '/path/to/hiera.yaml' your::variable.

You may also need to check your server logs to see if there is an error.

If you're using the Java Pupperserver, you may want to restart it due to
the change in environment caching.

Finally, you can add a notify to the code in question and see what comes
out the other side.

Trevor

On Thu, Mar 3, 2016 at 9:02 AM, Sans  wrote:

>
> Looks like to me it's not getting value from the Hiera at all. How can I
> make sure of that?
>
> -S
>
> On Thursday, March 3, 2016 at 1:28:51 PM UTC, Trevor Vaughan wrote:
>>
>> Hi Sam,
>>
>> Are you 100% sure that $wp_multisite is getting the value from Hiera?
>>
>> In this case, it looks like the value is empty.
>>
>> Thanks,
>>
>> Trevor
>>
>>
>> --
> 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/8cc362dc-cc0e-4e5a-bde2-aeec9045ef29%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699

-- This account not approved for unencrypted proprietary information --

-- 
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/CANs%2BFoVz03ChxSvtJaPxHiECFAbH1M4UvMXgA14TOupzWtuiOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Turning off client bucket

2016-03-03 Thread thyrsus
Specific syntax:

File {
backup => false,
}

On Friday, September 24, 2010 at 12:35:31 PM UTC-4, Patrick Mohr wrote:
>
> It can be turned off in the file resource itself.  That means you can do 
> it for all files if you default that value (assuming you don't override if 
> in a resource).
>
> Just put this in your site.pp.  This code might have typos in it, but gets 
> the point across:
>
> File {
> filebucket => none,
> }
>
>
> On Sep 24, 2010, at 7:35 AM, Marc Zampetti wrote:
>
> > How does one turn of the file bucket feature for puppetd. I simply don't 
> want backup copies of the files. I deal with things like that in a 
> different way. I cannot see how to turn it off.
> > 
> > Marc
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Puppet Users" group.
> > To post to this group, send email to puppet...@googlegroups.com 
> .
> > To unsubscribe from this group, send email to 
> puppet-users...@googlegroups.com .
> > For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> > 
>
>

-- 
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/e538b7d1-db36-4f99-91e0-0a3d1688b802%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: IS it possible to generate dynamically the configuration of a node ?

2016-03-03 Thread jcbollinger


On Wednesday, March 2, 2016 at 4:18:48 PM UTC-6, Martin Rodriguez wrote:
>
> Hi,
>
> I'm new to puppet and a java developer.
>
> I'm looking for a way to force the puppet server to connect to my java app 
> to get the configuration of a node ?
>
> If it is possible, could you please give an example of the code like a 
> hello world.
>
> I just simply want to generate file type configs dynamically 
> (configuration inside database) without to write directly the sites.pp file.
>


Puppet will not read manifests or catalogs from a database, but it does 
have mechanisms for plugging in dynamic components that drive configuration.

The "external node classifier" has already been mentioned -- this is a 
program that you can provide, and which Puppet will consult for lists of 
global variable values, classes to apply, and, optionally, class parameter 
values.  This data can be used either instead of or in addition to node 
blocks.

Additionally, Puppet's data binding subsystem, Hiera, supports custom 
back-ends, and it would be possible to write one that works as a wrapper 
for your application.  If you already have config data in a database, 
though, it might be more convenient to write a back-end that connects 
directly to the database.

Hiera can serve in almost all the same capacities that an ENC supports, and 
in some capacities that an ENC does not directly support.  The two have 
different strengths, however, and they are not mutually exclusive.


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/1c33dc18-ec24-49b3-9e02-7600f9450c8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] validate_bool() throwing in error syaing the value not a boolean

2016-03-03 Thread Sans

Looks like to me it's not getting value from the Hiera at all. How can I 
make sure of that?

-S

On Thursday, March 3, 2016 at 1:28:51 PM UTC, Trevor Vaughan wrote:
>
> Hi Sam,
>
> Are you 100% sure that $wp_multisite is getting the value from Hiera?
>
> In this case, it looks like the value is empty.
>
> Thanks,
>
> Trevor
>
>
>

-- 
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/8cc362dc-cc0e-4e5a-bde2-aeec9045ef29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] validate_bool() throwing in error syaing the value not a boolean

2016-03-03 Thread Trevor Vaughan
Hi Sam,

Are you 100% sure that $wp_multisite is getting the value from Hiera?

In this case, it looks like the value is empty.

Thanks,

Trevor

On Thu, Mar 3, 2016 at 5:23 AM, Sans  wrote:

>
> Hi guys,
>
> Suddenly started getting this error, which I cannot understand why I'm
> getting this:
>
>
> Error: Evaluation Error: Error while evaluating a Function Call, "" is not
> a boolean.  It looks to be a String at /usr/local/K101/puppet/modules/apps
> /manifests/app.pp:32:5 on node..
>
> the line 32 is: validate_bool($wp_multisite), which is coming from hiera
> and set to true
> Running PM in foreground or running the agent with --trace doesn't
> provide any additional information. I'm running out of ideas. Can anyone
> please help? Thanks in advance!!
>
> -S
>
> --
> 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/b6cc0809-a742-4f29-828b-27da5eda904e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699

-- This account not approved for unencrypted proprietary information --

-- 
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/CANs%2BFoUoeQW6ScDhMEZE4x7UOjBJeaGdw9Kmw9TnQphmPE%3DPwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] validate_bool() throwing in error syaing the value not a boolean

2016-03-03 Thread Sans

Hi guys,

Suddenly started getting this error, which I cannot understand why I'm 
getting this:


Error: Evaluation Error: Error while evaluating a Function Call, "" is not 
a boolean.  It looks to be a String at /usr/local/K101/puppet/modules/apps/
manifests/app.pp:32:5 on node..

the line 32 is: validate_bool($wp_multisite), which is coming from hiera 
and set to true
Running PM in foreground or running the agent with --trace doesn't provide 
any additional information. I'm running out of ideas. Can anyone please 
help? Thanks in advance!!

-S

-- 
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/b6cc0809-a742-4f29-828b-27da5eda904e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.