Re: [Puppet Users] params pattern when writing modules

2013-08-14 Thread Alessandro Franceschi
A small note on params.pp, even if I've largely used it in the Example42 
modules there are cases where it's totally uneffective, for example when 
you've to define there a parameters whose value may change according to 
another parameter the user may pass to init.pp

An example is here:
https://github.com/example42/puppet-logstash/blob/master/manifests/init.pp#L439
or even worse here:
https://github.com/example42/puppet-elasticsearch/blob/master/manifests/init.pp#L399
where some parameters change according to the installation method and I 
found myself placing horrible static references in init.pp

I still haven't found an elegant way to manage cases like this but, working 
with different modules scenarios I'm more and more convinced that different 
design patterns should be used according to the kind of module you're doing 
and the kind of options you want to throw in (for the above examples all 
the extra complexity is due to the option to have the possibility to choose 
how to install the application (via a package, downloading the upstream 
tarball ...).

my2c
al


On Wednesday, August 14, 2013 1:08:28 AM UTC+2, Ellison Marks wrote:

 Ah, good to know. I'll file some tickets as I come across instances of 
 this.

 On Tuesday, August 13, 2013 2:47:43 PM UTC-7, Ashley Penney wrote:

 As one of the two new maintainers of all Puppetlabs modules I can tell 
 you for sure that our intent is to make sure everything in init.pp inherits 
 out of params.pp instead of declaring them directly in the main class, and 
 if you're kind enough and can throw a github issue up for any cases you 
 notice where that's not true we can fix them.

 I never liked the params.pp pattern myself but there's no great solution 
 to where do I store all my weird logic to make the rest of my classes 
 simple.  We're standardizing on keeping all params defined in params.pp 
 and inheriting that in init.pp so that they can be overridden.

 I can't claim it's the best pattern, but we're at least going to strive 
 for consistency.

 (For background, each puppetlabs module was written by a different person 
 with their own views on this stuff and we had no unifying style guide or 
 guidelines to work from.  We're working on fixing these, but it takes time 
 and we don't want to barge in rewriting everything and upsetting current 
 users).


 On Tue, Aug 13, 2013 at 5:32 PM, Ellison Marks gty...@gmail.com wrote:

 So, I've been looking into the params pattern for writing modules, ie. 
 having a params.pp file that init.pp inherits from as a place to use custom 
 logic to set variables, and it seems very useful. I do have one question 
 that I'm hoping someone can answer. If, for example, I look at an example42 
 module, everything is in params.pp. On the other hand, looking at, say, 
 puppetlabs modules, there's some mixing, with the case statements 
 determining variable contents living in params.pp, but with straightforward 
 string and boolean values stored between params.pp and the argument list in 
 init.pp, with seemingly little logic dictating what goes where.

 Basically, what's people thoughts on the value of having every single 
 variable defined in params.pp, vs only the complex, logicky ones, and also, 
 in the case that I'm being dense, can someone explain the logic behind the 
 puppetlabs modules.
  
 -- 
 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 post to this group, send email to puppet...@googlegroups.com.
 Visit this group at http://groups.google.com/group/puppet-users.
 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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Puppet, Facter, looping through IPs

2013-08-14 Thread Christian Reiß
Hello all,

I am trying to set up ssh keys (sshkeys) for populate 
/etc/ssh/ssh_known_hosts. So far it works great, but I want to have aliases 
for all ips online on that host. 

Two problems:

- The assumption is that the interface count and names are unknown. There 
can be one eth or many, none but a xapi device etc. There is, however, 
interfaces variable from facter, which holds all the interfaces.

- I need to loop through the array and use the contents of that variable, 
ie:

interfaces = eth0,eth1,lo,tun0
ipaddress = 46.229.47.132
ipaddress_eth0 = 46.229.47.132
ipaddress_eth1 = 10.1.0.2
ipaddress_lo = 127.0.0.1
ipaddress_tun0 = 10.10.0.1

So I would need to loop through interfaces, query the variable with the 
same name to get the ip address. All this by acoiding loopback.

- I dont know a good way to then add all compiled aliases into sshkeys.

Does anyone have a pointer / solution?

Thank you for your help in advance,
Chris.

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




Re: [Puppet Users] Got a SOGo Puppet module?

2013-08-14 Thread Thomas Bendler
You realize users and groups without creating them (
http://docs.puppetlabs.com/guides/virtual_resources.html).

Regards Thomas

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




[Puppet Users] puppetdoc discards documentation having hash value in class.

2013-08-14 Thread Sneha More
Hi,
   I am generating rdoc by puppet doc, but it is not creating documentation
for the class having hash values.
Is there any way to solve this problem?

Regards,
Sneha More.

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




[Puppet Users] Re: puppetdoc discards documentation having hash value in class.

2013-08-14 Thread Sneha More
Hi,
  I would like to give the example for the problem i am facing

# Define:
#   common::def_ifcfg_bond
#
# Parameters:
#   device_bond:ifcfg-bondX DEVICE
#   bond_conf  :ifcfg_bond configuration parameter
# userctl :ifcfg-bondX USERCTL
# onboot  :ifcfg-bondX ONBOOT
#
# Actions:
#   At each of the specified setting, create the
/etc/sysconfig/network-scripts/ifcfg-bond file
define common::def_ifcfg_bond (

 $device_bond  = '',
 $bond_conf= {
  userctl   = '',
  onboot= '',
}
) {
 file { /etc/sysconfig/network-scripts/ifcfg-${device_bond} :
ensure  = present,
owner   = 'root',
group   = 'root',
mode= '0644',
content = template($ifcfg_bond_tmpl),
  }

}
Here the class has hash value $bond_conf  = { userctl  = '', onboot  =
'', }.
rdoc generated by puppet doc does not create documentation for it.

Regards,
Sneha More


On Wed, Aug 14, 2013 at 4:49 PM, Sneha More snehamore...@gmail.com wrote:

 Hi,
I am generating rdoc by puppet doc, but it is not creating
 documentation for the class having hash values.
 Is there any way to solve this problem?

 Regards,
 Sneha More.



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


Re: [Puppet Users] Puppet, Facter, looping through IPs

2013-08-14 Thread Dan White
This might be better done with a shell script that calls facter 


“Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us.” 
Bill Waterson (Calvin  Hobbes) 

- Original Message -
From: Christian Reiß reiss.symgen...@gmail.com 
To: puppet-users@googlegroups.com 
Sent: Wednesday, August 14, 2013 6:20:41 AM 
Subject: [Puppet Users] Puppet, Facter, looping through IPs 


Hello all, 

I am trying to set up ssh keys (sshkeys) for populate /etc/ssh/ssh_known_hosts. 
So far it works great, but I want to have aliases for all ips online on that 
host. 

Two problems: 

- The assumption is that the interface count and names are unknown. There can 
be one eth or many, none but a xapi device etc. There is, however, interfaces 
variable from facter, which holds all the interfaces. 

- I need to loop through the array and use the contents of that variable, ie: 

interfaces = eth0,eth1,lo,tun0 
ipaddress = 46.229.47.132 
ipaddress_eth0 = 46.229.47.132 
ipaddress_eth1 = 10.1.0.2 
ipaddress_lo = 127.0.0.1 
ipaddress_tun0 = 10.10.0.1 

So I would need to loop through interfaces, query the variable with the same 
name to get the ip address. All this by acoiding loopback. 

- I dont know a good way to then add all compiled aliases into sshkeys. 

Does anyone have a pointer / solution? 

Thank you for your help in advance, 
Chris. 


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com. 
To post to this group, send email to puppet-users@googlegroups.com. 
Visit this group at http://groups.google.com/group/puppet-users . 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Re: puppet-3.2.2 runs fine - but doesn't work. 2.7.22 works fine.

2013-08-14 Thread Klavs Klavsen
I switched to running webbrick instead of passenger - and it runs perfectly.

I'll try to go through my passenger setup on other puppetmasters that run 
3.x - and see if I can find any differences.

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




[Puppet Users] how to fix: Warning: calling Plugins.search with empty module path

2013-08-14 Thread Klavs Klavsen
Just setup Puppet 3.2.2 - with debug enabled in passenger, it complains 
about this:
Warning: calling Plugins.search with empty module path

and it does seem to not find any modules, nor plugins.

how do I fix that warning?

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




[Puppet Users] Environments; function error

2013-08-14 Thread Gregory Orange

Hi all,

We have two environments: production (containing one module) and 
experimental (two modules, one the same name as the module in 
production). All of our other modules are in the main module directory. 
Agent runs complete fine in the production environment, but not when 
switched to experimental. Error:


Error: Could not retrieve catalog from remote server: Error 400 on 
SERVER: Unknown function sprintf at 
/usr/local/etc/puppet/modules/config/manifests/init.pp:54 on node 
hostname.network


I figured that perhaps the modulepath wasn't right, but it turns out 
sprintf is a core function: 
http://docs.puppetlabs.com/references/latest/function.html#sprintf


Nothing in any of our modules implements or overrides sprintf, and 
sprintf is used in modules in the main module directory (i.e. by runs in 
both environments).


May I have some help troubleshooting this problem?

Thanks,
Greg.

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


[Puppet Users] Replace file based on content

2013-08-14 Thread redalert . commander
Hi,

I wanted to know if there is an easy way to replace a file in puppet (using 
the file directive) but only when a certain string exists.

My use case:
I have a package that installs a config file, I want to replace that file 
with puppet, but I in normal operation the application may also write to 
that file.
So a simple replace = true is not sufficient.

I tried with something like this:
define configfile ($source) {

$grepcommand = '/bin/grep --quiet string to check'
exec { check_${name}:
command = /bin/true,
onlyif = ${grepcommand} ${name},
}

file { $name:
ensure = present,
replace = true,
mode = 0644,
owner = 'user',
group = 'user',
source = $source,
require = Exec[check_${name}]
}

}

configfile {/etc/software/config.xml:
source = puppet:///modules/software/config.xml
}

I can't get that to work properly, the file is always getting replaced.

Regards,
Steven

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




[Puppet Users] Re: Puppet, Facter, looping through IPs

2013-08-14 Thread jcbollinger


On Wednesday, August 14, 2013 5:20:41 AM UTC-5, Christian Reiß wrote:

 Hello all,

 I am trying to set up ssh keys (sshkeys) for populate 
 /etc/ssh/ssh_known_hosts. So far it works great, but I want to have aliases 
 for all ips online on that host. 

 Two problems:

 - The assumption is that the interface count and names are unknown. There 
 can be one eth or many, none but a xapi device etc. There is, however, 
 interfaces variable from facter, which holds all the interfaces.

 - I need to loop through the array and use the contents of that variable, 
 ie:

 interfaces = eth0,eth1,lo,tun0
 ipaddress = 46.229.47.132
 ipaddress_eth0 = 46.229.47.132
 ipaddress_eth1 = 10.1.0.2
 ipaddress_lo = 127.0.0.1
 ipaddress_tun0 = 10.10.0.1

 So I would need to loop through interfaces, query the variable with the 
 same name to get the ip address. All this by acoiding loopback.

 - I dont know a good way to then add all compiled aliases into sshkeys.

 Does anyone have a pointer / solution?



I think you're saying you want to process the fact data to produce an array 
of the IP addresses (except of the loopback interface) to assign as the 
value of the 'host_aliases' parameter of an 'sshkey' resource.

You can obtain an array of the interface name from the $interfaces fact 
like so:

$interface_names = split($::interfaces, ',')

Given one interface name, you can interpolate the name into a string 
containing a template, then use the template to evaluate the desired Puppet 
variable, like so:

$interface_ipaddress = inline_template(%= @ipaddress_${interface_name} 
%)

But the inline_template() can produce only a string, not an array, and by 
itself that does not address processing all the interfaces.  I see three 
possible approaches:

   1. Write a custom function that computes the array of IP addresses for 
   you
   2. Use future functions: especially reduce() and maybe reject().  This 
   requires Puppet 3.2; see 
   http://docs.puppetlabs.com/references/3.2.latest/function.html#reduce
   3. Use an inline template to produce a delimited string of the IP 
   addresses, then split that to get the array you want.

I present a possible implementation of (3):

$interface_addresses = inline_template('%=
  @interface_names.reject{ |ifc| ifc == lo }.map{ |ifc| 
scope.lookupvar(ipaddress_#{ifc}) }.join( )
%')

$interface_addr_array = split($interface_addresses, ' ')

Note the use of scope.lookupvar(), which is a different way to retrieve the 
value of a dynamically-chosen Puppet variable.


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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Collector not realizing own exported resources when filtering on tags

2013-08-14 Thread jcbollinger


On Tuesday, August 13, 2013 12:29:51 PM UTC-5, Chuck Bredestege wrote:

 I'm trying to create a ssh class where the /etc/ssh/ssh_known_hosts and 
 /etc/ssh/shosts.equiv stays updated.  The issue i'm finding is that if I 
 include a tag == anything in the Collector filter, it collects all 
 resources EXCEPT it's own.  In this case, the known_hosts and .equiv files 
 will have all the other hostnames, but not it's own hostname.  If I remove 
 the tag == line it works as expected.  I tested this with a common tag 
 ssh which I verified is in puppetdb on both exports.

 [root@csep0501 ssh]# rpm -qa | grep puppet
 puppet-3.2.3-1.el5

 (where $dsitename is the lowercase version of a global fact)

 @@sshkey{ ${::fqdn}-ssh-pubkey :
 tag  = $dsitename,

 ensure   = present,
 host_aliases = [ $::hostname ],
 key  = $::sshrsakey,
 name = $::fqdn,
 type = 'ssh-rsa',
 }

 @@file_line{ ${::fqdn}-shosts.equiv :
 tag = $dsitename,
 path= /etc/ssh/shosts.equiv,
 ensure  = present,
 line= +${::fqdn},
 }

 notify { 'testmessage' :
 message = Downcased sitename is $dsitename,
 }

 Sshkey | tag == 'ssh' and tag == $dsitename | {
 require = File['/etc/ssh/ssh_known_hosts'],
 }
 File_line | tag == 'ssh' and tag == $dsitename and path == 
 /etc/ssh/shosts.equiv |  {
 require = File['/etc/ssh/shosts.equiv'],
 }


Why do you need parameter overrides for 'require'?  Does it not work to 
declare those directly in the original resource declarations?

Anyway, this looks similar to http://projects.puppetlabs.com/issues/11049.  
Can you work around it by explicitly collecting the node's own resources?  
For example, add

Sshkey | title == ${::fqdn}-ssh-pubkey |
File_line | title == ${::fqdn}-shosts.equiv |

(with the 'require' override too, if that turns out to be necessary).


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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Re: Problem with variable scope in Defined Types

2013-08-14 Thread jcbollinger


On Tuesday, August 13, 2013 9:59:22 PM UTC-5, Ygor wrote:

 I have a problem with variables in defined types. 

 I have dug a hole consisting of three levels of nested defines as in 
 --- 
 class users { 
 ... 
 } 
 --- 
 define users::useraccount ( 
 $username= $name, 
 $uid, 
 $info, 
 $ingroups= [], 
 $dotfiles= [], 
 $userhome= /home/${name}, 
 $ensure  = absent, 
 $is_role = false, 
 $role_users  = [], 
 $delete_role_users   = [], 
 $user_options= [], 
 ) { 

 ... 
 if $is_role { 
 ... 
 if ! empty ( $role_users ) { 
 $local_role_users = suffix ( $role_users, 
 _${username} ) 

 users::role_user_keys { $local_role_users: 
 ensure = present, 
 key_options = $user_options, 
 is_role = $is_role, 
 } 
 } 
 } 

 ... 
 } 
 --- 
 define users::role_user_keys ( 
 $ensure   = absent, 
 $key_options  = [], 
 $is_role  = true, 
 ) { 
 include 'stdlib' 

 $foo = split ( $title, '_' ) 
 $the_user = $foo[0] 
 $the_role = $foo[1] 

 users::restricted_ssh_user { $title: 
 username= $the_user, 
 ensure  = $ensure, 
 ssh_options = $key_options, 
 role_name   = $the_role, 
 is_role = $is_role, 
 } 
 } 
 --- 
 define users::restricted_ssh_user ( 
 $username, 
 $ensure   = absent, 
 $ssh_options  = [], 
 $is_role  = true, 
 $role_name, 
 ) { 
 include stdlib 

 case $is_role { 
 ‘roleA'   : { 
 $command_string = “/usr/local/${role_name}/local/bin/commandA 
 --user=${username} 
 $canned_options = [ 
 'no-port-forwarding', 
 'no-agent-forwarding', 
 'no-X11-forwarding', 
 'no-pty', 
 ] 

 $option_string = command=\${command_string}\ 
 $local_options = concat ( $canned_options, [$option_string] ) 
 } 
 ‘roleB'   : { 
 $command_string = “/usr/local/${role_name}/bin/commandB 
 --user=${username} 
 $canned_options = [ 
 'no-port-forwarding', 
 'no-X11-forwarding', 
 'no-pty', 
 ] 

 $option_string = command=\${command_string}\ 
 $local_options = concat ( $canned_options, [$option_string] ) 

 } 
 'admin' : { 
 $local_options = $ssh_options 
 } 
 default : { 
 $linkit = link 
 $command_string = 
 ${homedir}/bin/ssh_${role_name}_${username}” 

 $option_string = command=\${command_string}\ 
 $local_options = concat ( $ssh_options, [$option_string] ) 
 } 
 } 

 ssh_authorized_key { 
 ${username}_rsa_key_for_${role_name}_${is_role}: 
  ensure = $ensure, 
  key = file ( /etc/puppet/config/keys/${username}-rsa ), 
  type = 'ssh-rsa', 
  user = $role_name, 
  options = $local_options, 
 } 

 ssh_authorized_key { 
 ${username}_dss_key_for_${role_name}_${is_role}: 
  ensure = $ensure, 
  key = file ( /etc/puppet/config/keys/${username}-dss ), 
  type = 'ssh-dss', 
  user = $role_name, 
  options = $local_options, 
 } 

 } 

 The problem is in how I manipulate the array of option parameters as I go 
 down the levels ( user_options , key_options , ssh_options ) and the 
 contents of the array created with the “concat” function persists and 
 accumulates (snowballs!!) at the bottom level as the 
 users::restricted_ssh_user defined type in instantiated many times.  The 
 parameters were all called “options” at one point, and I made them 
 different, hoping that would work. 

 Is there a way to isolate the variables declared in a defined type 
 instance ? 
 Or do I need to trash this design and start over ?



I'm not sure I understand the problem(s).

With respect to the $local_options arrays generated via concat(), these are 
each assigned as resource parameters, so Puppet must retain them all until 
it finishes compiling the catalog.  The point appears to be that the 
options may vary from user to user, so if you have many users then many of 
these option strings must accumulate during catalog compilation.  How do 
you imagine it could be different?

However, it does look like in some cases you are creating temporary arrays 
that you do not need.  It could be that Puppet retains these for the 
duration of catalog compilation, even though it shouldn't need to do.  If 
that's the case, then you might be 

Re: [Puppet Users] Puppet runs extremly slow on 1 of 18 Windows Server

2013-08-14 Thread Sean Wolf
I ran into this same problem, and pe_compliance was the culprit-- took 120 
seconds.  Removing this class from the default group and re-running puppet 
made it run quickly again.


On Monday, October 1, 2012 2:08:08 PM UTC-6, Josh Cooper wrote:

 On Mon, Sep 3, 2012 at 2:07 AM, David Schmitt da...@dasz.at javascript: 
 wrote: 
  On 03.09.2012 09:45, Jan Ziegler wrote: 
  
  Hi, 
  
  We have 18 Windows Server in the same environment. All Windows Server 
  are build with an individual Windows Image, we created before, which 
  means, that all Windows Machines have the same configuration except 
  ip/mac address and hostname. 
  17 of those Windows Server run Puppet within 120 seconds per run. But 
  one of those Server took 49 hours for the run...the second one wasn't 
  faster. 
  
  We already installed this machine from bottom up several times, to be 
  sure, that this server has the same configuration as the other ones... 
  but without success. 
  
  The last lines before it takes some hours are: 
  
  info: Loading facts in C:\.. and so on 
  info: Loading facts in C:\.. and so on 
  info: Caching catalog for windowstest.domain 
  info: Applying configuration version '1346550140' 
  
  
  Any idea why this machine is so slow? It uses the same puppet classes 
 as 
  the other 17 server. 
  
  
  
  use --evaltrace to see which resources are evaluated. Maybe this gives 
 you a 
  hint what's happening. 
  
  Since you seem to be pretty sure this is not a problem rooted in the 
 machine 
  itself, the attentions focuses on the environment: Perhaps there is an 
  IP-collision with another device on the network? Perhaps the switchport 
 is 
  faulty? The underlying virtualisation has something fishy configured? 
 The 
  nameserver is acting up? etc. 
  
  
  
  Good hunting, D. 

 Did this issue get resolved? If not, what did --evaltrace show? Are 
 you managing file owner and group? 

 Josh 

 -- 
 Josh Cooper 
 Developer, Puppet Labs 


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


Re: [Puppet Users] Re: Installing Packages from puppet files

2013-08-14 Thread Dan M
Alternatively, you can use two-step approach to install RPM located at 
Puppet Master:
1. Copy the rpm file from Puppet Master to Puppet Agent
2. Install the rpm file on Puppet Agent from local path

This looks like following:
class ...{
... 
  package { 'python-boto':
ensure = installed,
provider = 'rpm',
source = '/tmp/python-boto.rpm',
require  = File[/tmp/python-boto.rpm],
  }

  file { /tmp/python-boto.rpm:
source = 
'puppet:///modules/profile/python-boto-2.5.2-3.el6.noarch.rpm',
  }  
...
}

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


[Puppet Users] Mcollective: remote commands

2013-08-14 Thread Sergey Arlashin
Hi!
Is it possible to use Mcollective to run different cli commands remotely on 
nodes? 
Cannot find anything related in the documentation. 

--
Best regards,
Sergey Arlashin

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


[Puppet Users] Can't remove a physical_volume from a volume_group

2013-08-14 Thread F. Y.
Hello,

I have this bit of code that tries to remove a physical volume from the VG 
(which consists of /dev/sda5 amd /dev/sdb1):

volume_group {
system:
ensure = absent,
physical_volumes = /dev/sdb1,
}

But I get this error:

Error: Execution of '/sbin/vgremove system' returned 5: Do you really want 
to remove volume group system containing 2 logical volumes? [y/n]:   
Volume group system not removed
Error: /Stage[main]/Node_emake/Volume_group[system]/ensure: change from 
present to absent failed: Execution of '/sbin/vgremove system' returned 5: 
Do you really want to remove volume group system containing 2 logical 
volumes? [y/n]:   Volume group system not removed

Is there a way to force it or a work around?

Thank you 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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Can't remove a physical_volume from a volume_group

2013-08-14 Thread Ramin K

On 8/14/2013 2:33 PM, F. Y. wrote:

Hello,

I have this bit of code that tries to remove a physical volume from the
VG (which consists of /dev/sda5 amd /dev/sdb1):

 volume_group {
 system:
 ensure = absent,
 physical_volumes = /dev/sdb1,
 }

But I get this error:

Error: Execution of '/sbin/vgremove system' returned 5: Do you really
want to remove volume group system containing 2 logical volumes?
[y/n]:   Volume group system not removed
Error: /Stage[main]/Node_emake/Volume_group[system]/ensure: change from
present to absent failed: Execution of '/sbin/vgremove system' returned
5: Do you really want to remove volume group system containing 2
logical volumes? [y/n]:   Volume group system not removed

Is there a way to force it or a work around?

Thank you in advance.


	Your define statement is wrong. volume_group { 'system': ensure = 
absent } will attempt to remove the volume group regardless of the other 
parameters. You want simply


volume_group { 'system':
  ensure   = present,
  physical_volumes = '/dev/sda5', # or whatever pv you want to keep
}

Assuming you're using the puppetlabs-lvm module it'll handle comparing 
the physical volume membership of the volume group and call vgreduce or 
vgextend as needed.


Ramin

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


[Puppet Users] Re: introducing puppetboard 0.0.1

2013-08-14 Thread Daniele Sluijters
Hey,

Good catch, I'll get that fixed asap.

-- 
Daniele Sluijters

On Tuesday, 13 August 2013 22:36:35 UTC+2, Ellison Marks wrote:

 Er, excuse me, I misspoke. As it is it relies on having python 2.7+, not 3 
 for the formatting. Still, the Redhat family, by default, is still on 2.6.

 On Tuesday, August 13, 2013 12:13:17 PM UTC-7, Ellison Marks wrote:

 So I finally got the time to get this going, and it is indeed, very cool. 
 One hitch though: I grabbed the source from github, and most things seemed 
 to work, but the overview page errored out. It seems that it was using 
 python 3 syntax for it's format strings on line 86 and 88.

 86: 'avg_resources_node': {:10.6f}.format(avg_resources_node['Value']),
 87: 'mean_failed_commands': mean_failed_commands['MeanRate'],
 88: 'mean_command_time': {:10.6f}.format(mean_command_time['MeanRate']),

 I added a 0 to the format specification and it worked  fine

 86: 'avg_resources_node': {0:10.6f}.format(avg_resources_node['Value']),
 87: 'mean_failed_commands': mean_failed_commands['MeanRate'],
 88: 'mean_command_time': 
 {0:10.6f}.format(mean_command_time['MeanRate']),

 On Wednesday, August 7, 2013 5:47:23 AM UTC-7, Daniele Sluijters wrote:

 Hello everyone,


 It’s a lovely grey and rainy day here in the Dutch summer, as good a day 
 as any to release a new little project.


 Its name is Puppetboard and has as aim to replace Puppet Dashboard’s 
 reporting functionality. It does not nor will it include ENC features. It 
 does all this without storing any data itself but querying PuppetDB instead.


 The whole thing is built in Python and relies on Flask and WTForms. The 
 communication logic has been split of in its own library called pypuppetdb 
 which makes heavy use of the requests library. The interface is powered by 
 Twitter Bootstrap with the Flatly theme.


 Though I’ve pushed all the code out and made it public it’s all very 
 young but it works fairly well. However, I’ve committed numerous 
 barbarities in the code just to get things working and to figure out how to 
 handle certain things. For the foreseeable time in the future I’ll be 
 working on cleaning all this up and figuring out what I can do on my side 
 and on PuppetDB’s side to make all this work a little better. Especially 
 when it comes to dealing with big responses from PuppetDB...


 This is the first time I’m open sourcing a project so that too is all 
 new to me. I’d welcome the feedback and if someone feels brave enough even 
 commits on the projects but try and be gentle about it :-). I’ll also be at 
 PuppetConf including the Developer Day so feel free to reach out to me in 
 person.


 To the code:


  * puppetboard: https://github.com/nedap/puppetboard

  * pypuppetdb:  https://github.com/nedap/pypuppetdb


 I realise that puppetboard doesn't have a test suite right now but it 
 will soon. In order to do so I have to restructure a few things about it 
 first. The installation documentation will improve with it.


 Pypuppetdb's test suite will be expanding the coming days once I'm done 
 mocking the HTTP requests _query() makes and manage to get a decent and big 
 enough set of test data to feed into PuppetDB. This will allow me to run 
 integration tests and benchmark certain changes I have in mind.


 I’m hoping to be able to get a release out every month with improvements 
 to both projects, perhaps even faster in the beginning but it remains to be 
 seen how much time I’ll be able to spend on it.


 A special thanks goes out to Ken Barber for helping out with all things 
 PuppetDB and coming up with a way to run PuppetDB on Travis so we can run 
 integration tests. Hunter, thank you for being so interested in this 
 project and pushing me to release it.


 — 

 Daniele Sluijters

 Nedap | Steppingstone



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


Re: [Puppet Users] Re: Problem with variable scope in Defined Types

2013-08-14 Thread Dan White

On Aug 14, 2013, at 2:13 PM, jcbollinger wrote:
 On Tuesday, August 13, 2013 9:59:22 PM UTC-5, Ygor wrote:
 I have a problem with variables in defined types. 
 
 I have dug a hole consisting of three levels of nested defines as in 
 
 --- snip  
 
 The problem is in how I manipulate the array of option parameters as I go 
 down the levels ( user_options , key_options , ssh_options ) and the contents 
 of the array created with the “concat” function persists and accumulates 
 (snowballs!!) at the bottom level as the users::restricted_ssh_user defined 
 type in instantiated many times.  The parameters were all called “options” at 
 one point, and I made them different, hoping that would work. 
 
 Is there a way to isolate the variables declared in a defined type instance ? 
 Or do I need to trash this design and start over ?
 
 
 I'm not sure I understand the problem(s).
 
 With respect to the $local_options arrays generated via concat(), these are 
 each assigned as resource parameters, so Puppet must retain them all until it 
 finishes compiling the catalog.  The point appears to be that the options may 
 vary from user to user, so if you have many users then many of these option 
 strings must accumulate during catalog compilation.  How do you imagine it 
 could be different?
 
 However, it does look like in some cases you are creating temporary arrays 
 that you do not need.  It could be that Puppet retains these for the duration 
 of catalog compilation, even though it shouldn't need to do.  If that's the 
 case, then you might be able to lighten the load a bit by dropping the 
 temporaries.  For instance, you could avoid the $canned_options, 
 $command_string, and $option_string variables in the 'roleA' case by writing 
 the option array like this:
 
 $local_options = [ 
   'no-port-forwarding', 
   'no-agent-forwarding', 
   'no-X11-forwarding', 
   'no-pty', 
   command=\/usr/local/${role_name}/local/bin/commandA --user=${username}\
 ] 
 
 I don't know whether that will really gain you anything, though, especially 
 inasmuch as you cannot do the same for the default case.
 
 You might also achieve a bit of savings by merging users::restricted_ssh_user 
 back into users::role_user_keys.  As you present those, I don't see what you 
 gain by separating them.
 
 Ultimately, though, I don't think your option arrays grossly outweigh 
 everything else declared per-user.  If you are experiencing a capacity 
 problem, then you may need to take an altogether different approach, such as 
 managing  ~/.ssh/authorized_keys as a whole, via a template, instead of 
 declaring thousands of Ssh_authorized_key resources.
 
 
 John

Thanks for staring your opinion and thoughts, John.

I think part of the problem is feature creep.

It started with just creating user accounts
Then I added ssh keys
Then I added role accounts 
Then I added ssh keys for role accounts

The whole mess needs refactoring.

I will try your idea of eliminating the temporaries and see how far I get.

One thing I found about the ssh_authorized_key type is that is does not work 
with :
resource { ‘ssh_authorized_key’: purge = true, }
so I have to explicitly un-manage the keys

When you say managing  ~/.ssh/authorized_keys as a whole, via a template”, do 
you mean as a separate class rather than as a facet of my “users” class ?


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