Re: [Puppet Users] Puppet variable within a Fact

2014-11-18 Thread Antoine Cotten
True, I could try the file approach, the only drawback is that it would 
take 1 Puppet run before the fact is defined, but the same would hold true 
with the environment variable.

Thanks Henrik!

-- 
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/fad25666-a803-4548-b63d-b9fbaa06fe1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: scope of variable inside defined type

2014-11-18 Thread Antoine Cotten
What about the getparam function from the stdlib module 
https://forge.puppetlabs.com/puppetlabs/stdlib?

Quote:

define example_resource($param) { }

example_resource { example_resource_instance: param = param_value }

getparam(Example_resource[example_resource_instance], param)


-- 
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/66548885-1d97-4df4-b1df-4ee7c9521cfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet variable with a custom fact

2014-11-17 Thread Antoine Cotten
Hi Puppet users,

Is there any convenient way to access a variable defined in a Puppet class 
from within a custom fact?

I'm trying to reuse a Puppet variable within a fact definition, but can't 
find any way to look it up like I would do within an ERB template.

Example (fictional):
Facter.add(:tomcat_package) do
  tomcat_package_name = scope.lookupvar(::tomcat::package_name)
  setcode do
tomcat_package_name
  end
end

I could export a FACTER_ environment variable instead, but that's not very 
convenient in my case.

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/7afd731a-bd21-4f75-a812-a1e466202188%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet variable within a Fact

2014-11-17 Thread Antoine Cotten
Dear fellow Puppet users,

Is there any convenient way to access a variable defined in a Puppet class 
from within a custom fact?

I'm trying to reuse a Puppet variable within a fact definition, but can't 
find any way to look it up like I would do within an ERB template.

Example (fictional):
Facter.add(:tomcat_package) do
  tomcat_package_name = scope.lookupvar(::tomcat::package_name)
  setcode do
tomcat_package_name
  end
end

I could export a FACTER_ environment variable instead, but that's not very 
convenient in my case.

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/035e6872-d058-4e9b-80c8-f66bfb4f5632%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Cannot set variables via Hiera for a module I've written

2014-09-25 Thread Antoine Cotten
Hi Danny,

You should 'include' your main class (zabbix) before, or even inside your 
sub-classes, else nothing tells you in which order they will be declared, 
and apparently classes like zabbix::client::service DO require the 
parameters set in your main class.

Something like that should work:
   
class zabbix::client::service inherits zabbix::params {   # ensure the main 
class is declared
  include ::zabix

  if ($client_startagents != '0' and $client_server == '') {fail(Your 
StartAgents cannot be greater than 0 or null when Server is also null. Set 
StartAgents to 0 or set Server.)  }
...


Toni

-- 
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/5cae315d-d735-4a64-af43-8e8f56915a2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Example of how to use require with hiera?

2014-09-22 Thread Antoine Cotten
Does this actually work Nan??
Can somebody point me to any page where this is documented?

Toni



On Friday, September 19, 2014 6:33:07 PM UTC+2, Nan Liu wrote:

 On Thu, Sep 18, 2014 at 6:19 PM, Daniel Johnson tekn...@gmail.com 
 javascript: wrote:

 Things like

 require: File['somefile']

 or

 require:
   File: somefile

 both crash, and burn.

 Not having a require also causes failure as it tries to do things it
 can't without the prerequisite.

 After hours of searching I couldn't find any examples to work from.


 If you are building a resource hash for create_resources, it's just quoted 
 string:

 ---
 notify:
   example1:
 message: first
   example2:
 message: second
 require: Notify[example1]

 create_resources(notify, hiera('notify'))

 HTH,

 Nan


-- 
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/f8042e80-fa4d-45cd-892e-d46afd234a15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Locally Written Puppet Module Does Not Dislay Version Number With: puppet module list

2014-09-19 Thread Antoine Cotten
What nikolavp said is true, the metadata.json became the standard starting 
from Puppet 3.6, but since you use 3.5 the Modulefile still prevails.

Off subject: any reason not to upgrade your master? I have really bad 
memories of Puppet 3.5 on CentOS, whereas 3.6 fixed all my troubles. Would 
also allow you to use your metadata.json files as you intended.

Cheers,

Toni

-- 
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/bff1df0f-b5f2-40a6-a1d0-14f4ec81f706%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Example of how to use require with hiera?

2014-09-19 Thread Antoine Cotten
Hi teknotus,

I don't think that would work since you can not declare a Puppet resource 
in Hiera, you are limited to core types.
In your case, Puppet would interpret File['somefile'] as a string, and 
File: somefile as a hash, but will never translate that to a resource.

Cheers,

Toni

-- 
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/af915a19-8bf4-47ac-b09c-85b3b914b988%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppetlabs-apache n00b question - docroot value for fully proxied virtual host?

2014-09-16 Thread Antoine Cotten
Unfortunately you can't. This is a restriction of Apache, which requires a 
docroot value for every vhost, and not of Puppet.

-- 
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/8c6a00ee-3cb6-4193-936a-6acc771142ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Moving away from Puppet Enterrpize piecemeal?

2014-09-06 Thread Antoine Cotten
Hi Matthew,

I also moved from PE to Puppet Open-Source. I actually got started with the 
10 nodes free licence before feeling comfortable enough to puppetize my 60 
VMs, so the operation was performed at much smaller scale than in your case 
probably. From what I experienced:

1) Exporting/importing PostreSQL data works just fine, but make sure you 
run PostgreSQL 9.2+ as older versions are deprecated since PuppetDB 2.2.
Besides I don't see any reason why it wouldn't work with your current 
Puppet Enterprise as long as the terminus matches the running PuppetDB 
version, but you will need to check the installation paths (both versions 
install in different folders)

1.5) Dashboard doesn't use the same DB, it CAN use the same instance but 
not necessarily. As long as you use the right DB config in 
/etc/puppetdb/conf.d/database.ini it works flawlessly.

2) Yes, migrate your master first, this is valid for any Puppet upgrade :) 
However PE 3.3 ships with a fairly recent Puppet version so you shouldn't 
run into trouble if you upgrade agents first, but this is not a good 
practice (read the release notes carefully)


Hope my 2 cents helped you

Cheers

Toni

-- 
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/e54a539c-b21d-4d02-89ee-9111b3215da8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: client not seeing changes made on puppetmaster

2014-09-05 Thread Antoine Cotten
Hi Mike,

It's very likely due to Directory Environments caching. By the default the 
environment 
timeout 
https://docs.puppetlabs.com/references/3.7.latest/configuration.html#environmenttimeout
 
is 3m, which means you whole environment will cached during this time.

You can enforce the value of this parameter to 0 if you do some testing 
(make sure to restart your master), either per environment or globally in 
your puppet.conf file.

More information here: 
https://docs.puppetlabs.com/puppet/latest/reference/environments_configuring.html#environmenttimeout

Cheers,

Toni



On Thursday, September 4, 2014 9:28:10 PM UTC+2, Mike Reed wrote:

 Greetings,

 I have a class for which I would like to simply print a few parameters 
 about a node, before actually running any additional modules on the client 
 itself.  The problem I'm seeing is that after making changes to the class, 
 I don't see them being propagated to the puppet client.  Occasionally if I 
 restart puppet services on both client and master, the changes will get 
 pulled down.  In other occasions, after a certain amount of time, the 
 changes will just magically appear to get pulled down by the client.  Does 
 anybody know why this may be occurring?  It's driving me mad.

 I have a vanilla puppet client running puppet 3.6.2 and a puppet master 
 running version 3.6.2. and both have been recently built.

 *Site.pp:*

 # test node
 node seanconnery-01 {
   include role
 }

 class role {
   include profile::base
 }

 class profile::base {
   include sys_ident
 }


 *sys_ident/init.pp*

 class sys_ident {
   notify { 'system hostname':
 withpath = true,
 name = my fqdn is $fqdn,
 }

   notify {'network location':
 withpath = true,
 name = my network is ${network},
   }
 }

 *Upon running the client, I get the expected output:*
 seanconnery-01:~$ sudo puppet agent -tv
 Info: Retrieving pluginfacts
 Info: Retrieving plugin
 Info: Loading facts in /var/lib/puppet/lib/facter/network.rb
 Info: Caching catalog for seanconnery-01.domain
 Info: Applying configuration version '1409858463'
 Notice: /Stage[main]/Sys_ident/Notify[network location]/message: my 
 network is greenzone
 Notice: /Stage[main]/Sys_ident/Notify[network location]/message: defined 
 'message' as 'my network is greenzone'
 Notice: /Stage[main]/Sys_ident/Notify[system hostname]/message: my fqdn is 
 seanconnery-01.domain
 Notice: /Stage[main]/Sys_ident/Notify[system hostname]/message: defined 
 'message' as 'my fqdn is seanconnery-01.domain
 Notice: Finished catalog run in 0.04 seconds

 *However, if I add another notify to the sys_ident/init.pp like so:*

 class sys_ident {
   notify { 'system hostname':
 withpath = true,
 name = my fqdn is $fqdn,
 }

   notify {'network location':
 withpath = true,
 name = my network is ${network},
   }

   notify {'swapfree':
 withpath = true,
 name = my swap is ${swapfree},
   }
 }

 *I get the following on my client:*
 seanconnery-01:~$ sudo puppet agent -tv
 Info: Retrieving pluginfacts
 Info: Retrieving plugin
 Info: Loading facts in /var/lib/puppet/lib/facter/network.rb
 Info: Caching catalog for seanconnery-01.domain
 Info: Applying configuration version '1409858679'
 Notice: /Stage[main]/Sys_ident/Notify[network location]/message: my 
 network is greenzone
 Notice: /Stage[main]/Sys_ident/Notify[network location]/message: defined 
 'message' as 'my network is greenzone'
 Notice: /Stage[main]/Sys_ident/Notify[system hostname]/message: my fqdn is 
 seanconnery-01.domain'
 Notice: /Stage[main]/Sys_ident/Notify[system hostname]/message: defined 
 'message' as 'my fqdn is seanconnery-01.domain'
 Notice: Finished catalog run in 0.04 seconds

 After a certain amount of undetermined time, the client will finally 
 pickup the changes but there's no rhyme or reason to it.
 Has anybody else ever seen this behavior?  I can't for the life of me 
 figure it out.

 As always, your help is much appreciated.

 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/a00e8ab2-b9f0-4be6-b11e-378080f6636d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Problem with Hiera deep merge

2014-07-25 Thread Antoine Cotten
Hi Puppet users,

I've been using Hiera's deep merge feature on class parameters for months, 
however when I try to pair it with the create_resources function things get 
ugly.

Situation:
I want to deploy a set of Unix users on all my machines. They have standard 
rights by default and get access to the wheel group on a per-server basis 
depending on their needs.

In my module I have:

manifests/user.pp

 class environment::users ( $users = hiera_hash('user_list') {
   create_resources('user', $users)
 }


And in Hiera:

hiera/common.yaml

 ---
 user_list:
   foo:
 ensure: present
 uid: '1001'
 gid: '1001'
 groups: []
 comment: Doctor Foo
   bar:
 ensure: present
 uid: '1002'
 gid: '1002'
 groups: []
 comment: Mister Bar



*It works great so far.* All my users are deployed on all machines.

Now I try to add the user foo to the wheel group on dev_server:

hiera/dev_server.example.com.yaml

 ---
 user_list:
   foo:
 groups: wheel


Since the deeper 
http://docs.puppetlabs.com/hiera/1/lookup_types.html#deep-merging-in-hiera--120
 
merge bahavior is enabled this should merge my user list just fine.
But... BANG! It all breaks apart:

 *Error: Could not retrieve catalog from remote server: Error 400 on 
 SERVER: Must pass uid to User[foo] on node *

 *dev_server.example.comWarning: Not using cache on failed catalogError: 
 Could not retrieve catalog; skipping run*


However, if I query Hiera from the shell, it returns the expected user hash:

$ hiera --hash user_list ::clientcert=dev_server.example.com

 {foo=
   {ensure=present,
gid=1001,
groups=wheel,
comment=Mister Foo,
uid=1001},
  bar=
   {ensure=present,
gid=1002,
groups=[],
comment=Doctor Bar,
uid=1002}}



Corruption? Madness? Did I miss something crucial when reading through the 
documentation?

Thank you in advance for the hints :)

*Toni*

---

Just for your information:

   - Puppet 3.6.2
   - Hiera 1.3.4
   - deep_merge gem 1.0.1
   
Here is my hiera.yaml file (Puppet and the command line tool use strictly 
the same file)

hiera.yaml

 ---
 :backends:
   - yaml
 :hierarchy:
   - %{::clientcert}
   - common
 :merge_behavior: deeper
 :yaml:
   :datadir: /etc/puppet/hiera


-- 
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/59f5015d-073f-4b9b-ae89-7fb911cbf90d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Problem with Hiera deep merge

2014-07-25 Thread Antoine Cotten
*Btw, please ignore the typo (missing parenthesis) in the manifest, trust 
me it's not here in the real manifest.*

Funny fact I just discovered: if I move the $user parameter INSIDE the code 
of the class, and get rid of the class parameter (of course) it works just 
fine. So why would the hiera_hash function not work properly when called in 
class parameters?

-- 
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/bb6c1714-88ed-4d4e-928a-f86df3e55743%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Problem with Hiera deep merge

2014-07-25 Thread Antoine Cotten
I actually found the answer in another topic 
https://groups.google.com/forum/#!searchin/puppet-users/Puppet$203.1.1$2C$20hiera$20and$20parameter$20autoload/puppet-users/FezqytcHBeA/BC5xKG5e78cJ
.

I changed my variable name to $unixusers instead of $users and it started 
working. I suspect a naming conflict within my class, since another $users 
variable was declared at a higher level.

-- 
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/ecd350c9-82b3-4e81-862c-99a031127f1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Serious performance issues with Puppet 3.5.x when using Directory Environments

2014-05-12 Thread Antoine Cotten
Hi Josh, hi all,

So, I have set the environment_timeout setting to a couple of test values, 
including 30s, 1h and unlimited:

   - *30s* - No performance boost. Too short for me, my Puppet runs are 
   distributed every 37s
   - *1h* - Very good results, fast config retrieval, even slighly better 
   than with config-based environments
   - *unlimited* - same as above
   
Regarding performance issues please ignore my previous message, I had some 
other troubles in my vSphere environment which caused these CPU and memory 
peaks. *My Puppet master behaves in a very stable way now*.

Cheers,

--
Toni

-- 
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/7ed02dd8-8dfe-4ea2-bcc1-d864132aa761%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Serious performance issues with Puppet 3.5.x when using Directory Environments

2014-05-09 Thread Antoine Cotten
Hi Josh,

I will test it today and tell you what I observe.

Regarding performances:

   - the increase in CPU consumption is hard to quantify precisely. I can 
   only tell the load average changed from ~0.30-0.60 to ~1.00-1.50 with 
   regular peaks up to 2.50. Nagios even reported 15.0 a couple of times in 
   the past 2 days.
   - it uses a lot more memory. Before my memory consumption was constantly 
   around 60% of 3GB, now it oscillates around 90% and my master swaps a lot. 
   Nagios gets quite crazy about it.

To be continued...





On Wednesday, May 7, 2014 5:59:48 PM UTC+2, Josh Partlow wrote:

 On Wed, May 7, 2014 at 6:24 AM, Antoine Cotten 
 tonio@gmail.comjavascript:
  wrote:

 Thanks Josh,

 This seems to work better indeed, although I can still observe a decrease 
 in performances. The config retrieval time is higher than with config-based 
 environments (9 sec - 26 sec on average), and CPU-wise I can also notice 
 an increase but this is hard to quantify without prolonged monitoring, I'll 
 let it run for 24 extra hours before giving any conclusion. But, well, 
 nothing compared to v3.5.1 fortunately, so I believe this RC1 is promising!

 Feel free to ask if you need any data or extra feedback from me.


 Thanks for testing this, Antoine!  There is a time to live setting for the 
 new environment cache which defaults to 5 seconds.  It's 
 'environment_timeout' and you can set it in your puppet.conf, or per 
 directory environment in it's environment.conf.  I'm curious what, if any, 
 change you see setting it to say '30s', and what change if you set it 
 'unlimited'.

 Would you have time to test that?

 thanks,
 Josh
  

 --
 Toni




 On Tuesday, May 6, 2014 10:55:24 PM UTC+2, Josh Partlow wrote:

 Hi Antoine,

 There is a Puppet 3.6.0-rc1 available in the pre-release repos which has 
 environment cacheing that we think will take care of the slowdown you are 
 seeing with directory environments.  Would you be able to test that?  (See 
 Eric's 3.6.0-rc1 announcement for details on obtaining the packages)

 thanks,
 Josh

 On Tuesday, April 22, 2014 11:26:47 AM UTC-7, Eric Sorenson wrote:



 On Tuesday, April 22, 2014 5:25:55 AM UTC-7, Antoine Cotten wrote:

 Hi Eric,
 thank you for pointing me to this feature, and sorry for the answer 
 time. 

 I managed to outline the problematic parts in the Puppet run: the 
 final POST method takes forever when Directory Environments is enabled 
 (1) 
 and the catalog compilation is overall much slower (1.3./4|5|6/)

 I triggered a run on the same node, with and without the feature 
 enabled. Here are the corresponding profiling logs:


 Thanks, this is great information.

 The reason the POST looks slow is because it's an aggregate of all the 
 steps that came before it, as you see the profile step numbers pop out a 
 level, that line aggregates the times of everything inside it.  So the 
 POST 
 is the aggregate of all the steps to compilation.

 I am looking at this more closely and I have opened https://tickets.
 puppetlabs.com/browse/PUP-2337 to track it.

 --eric0

  -- 
 You received this message because you are subscribed to a topic in the 
 Google Groups Puppet Users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/puppet-users/wzy8NPWauu4/unsubscribe.
 To unsubscribe from this group and all its topics, 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/0008dd5d-fab6-4d01-b206-6a1994236b42%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/0008dd5d-fab6-4d01-b206-6a1994236b42%40googlegroups.com?utm_medium=emailutm_source=footer
 .

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




 -- 
 Josh Partlow
 jpar...@puppetlabs.com javascript:
 Developer, Puppet Labs

 Join us at PuppetConf 2014, September 22-24 in San Francisco - 
 http://puppetconf.com
 Register by May 30th to take advantage of the Early Adopter discount —save 
 $349!
  

-- 
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/b1120ecb-2158-4391-8bda-34f6c2cfac51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Serious performance issues with Puppet 3.5.x when using Directory Environments

2014-05-07 Thread Antoine Cotten
Thanks Josh,

This seems to work better indeed, although I can still observe a decrease 
in performances. The config retrieval time is higher than with config-based 
environments (9 sec - 26 sec on average), and CPU-wise I can also notice 
an increase but this is hard to quantify without prolonged monitoring, I'll 
let it run for 24 extra hours before giving any conclusion. But, well, 
nothing compared to v3.5.1 fortunately, so I believe this RC1 is promising!

Feel free to ask if you need any data or extra feedback from me.

--
Toni



On Tuesday, May 6, 2014 10:55:24 PM UTC+2, Josh Partlow wrote:

 Hi Antoine,

 There is a Puppet 3.6.0-rc1 available in the pre-release repos which has 
 environment cacheing that we think will take care of the slowdown you are 
 seeing with directory environments.  Would you be able to test that?  (See 
 Eric's 3.6.0-rc1 announcement for details on obtaining the packages)

 thanks,
 Josh

 On Tuesday, April 22, 2014 11:26:47 AM UTC-7, Eric Sorenson wrote:



 On Tuesday, April 22, 2014 5:25:55 AM UTC-7, Antoine Cotten wrote:

 Hi Eric,
 thank you for pointing me to this feature, and sorry for the answer 
 time. 

 I managed to outline the problematic parts in the Puppet run: the final 
 POST method takes forever when Directory Environments is enabled (1) and 
 the catalog compilation is overall much slower (1.3./4|5|6/)

 I triggered a run on the same node, with and without the feature 
 enabled. Here are the corresponding profiling logs:


 Thanks, this is great information.

 The reason the POST looks slow is because it's an aggregate of all the 
 steps that came before it, as you see the profile step numbers pop out a 
 level, that line aggregates the times of everything inside it.  So the POST 
 is the aggregate of all the steps to compilation.

 I am looking at this more closely and I have opened 
 https://tickets.puppetlabs.com/browse/PUP-2337 to track it.

 --eric0



-- 
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/0008dd5d-fab6-4d01-b206-6a1994236b42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Best practice question: Class(es) with client/server config

2014-04-25 Thread Antoine Cotten
I don't pretend to give you best practices here, but I would personally 
create one cups class as an entry point, with two (at least) boolean 
parameters: client and server. 
client defaults to true and server to false, either using class defaults or 
Hiera's base hierarchy level.
Then you could imagine having two subclasses cups::client and cups::serverwhich 
do the things you want. In your main class, you just have to call 
either of them using a conditional statement.

With this approach you can apply the cups class safely to any node by 
default, and override the server boolean just for your CUPS server in 
either the Hiera hierarchy or site.pp.

Toni


On Friday, April 25, 2014 2:35:10 AM UTC+2, Joachim Schrod wrote:

 Hi, 

 I've got question about best practice, and am interested in advice 
 from you experienced folk. 

 I have a service where there is one server in my net and many 
 clients (actually, all systems are clients): CUPS. In client 
 setups, one file has to be changed (client.conf), in server setup 
 several (cupsd.conf with policy, several printers are installed). 
 On the server, client.conf must not be changed. 

 Is it better to create 2 clases (cupsclient, cupsserver) or one 
 class (cups)? 

 One class would mean to set a role (client, server) via Hiera and 
 distinguish the target configuration via that role. I.e., within 
 the class one giant if with two completely different target 
 configurations. Doesn't sound pretty or good style. 

 When I use two classes I have the problem how to specify when the 
 right class should be declared: What I would like to have is a 
 method to declare cupsclient for all nodes, and override that 
 declaration for the one node/role that's the server where it should 
 be cupsserver. I can't see how I do that properly. (Most class 
 declarations are in role files, roles are assigned to nodes via 
 Hiera. I don't want to add cupsclient declaration to any and all 
 roles except that server role, that repetition is the reason that I 
 don't like this approach.) 

 So I see two approaches, both with deficiencies. 
 What approach do I miss? 
 How can one of these approaches be changed to get rid of the 
 described deficiency? 

 Can I specify the class name to be declared as a parameter in Hiera? 

 Thanks in advance for any answer, 

 Joachim 

 PS: The distinction of node/role is not relevant in that use case. 
 That server exists only once, it factually _is_ its own role. 

 -- 
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
 Joachim Schrod, Roedermark, Germany 
 Email: jsc...@acm.org javascript: 



-- 
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/2da28f32-f5be-4540-96d9-8b79ebe36092%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: using custom array based fact with defined type

2014-04-23 Thread Antoine Cotten
Actually Facter does support arrays since v2.0.1, Ritesh did not mention 
which version he was using.

Ritesh if you use Facter 2.0.1 I recommend you to make sure your fact is an 
actual Structured Fact, like described in this documentation page: Facter 
2.0: Overview of Custom Facts With 
Exampleshttp://docs.puppetlabs.com/facter/2.0/fact_overview.html#writing-structured-facts
I suspect you're trying to build an array from Strings using a funny 
construction, like concatenate [ and ] to your data, am I right? This 
is indeed how you define it in Puppet DSL, but in Ruby (and Facter) this 
would still be recognized as a string.


On Tuesday, April 22, 2014 9:47:20 PM UTC+2, Jose Luis Ledesma wrote:

 Facter doesn't support arrays, only strings until v2.0, so the only way I 
 know if what you did, although I usually use this form:

 Anyfact = value1,value2,value3

 And then just split with the ,

 Regards,
 El 22/04/2014 20:10, Ritesh Nanda ritesh...@gmail.com javascript: 
 escribió:

 Hello Toni , John

 Thanks for your help.

 Doing validate array gives a  

  Error 400 on SERVER:  is not an Array.  It looks to be a String

 I made it working using  $arrayvar = split($::arraydev, '[,]') then 
 calling  test::exeecho{$arrayvar:} , in this way it works and its process 
 the array . 

 now the init.pp looks like 

 class test {
 $arrayvar = split($::arraydev, '[,]')
 test::exeecho{$arrayvar:}
 }

 Doing validate array tells me it is string not an array , Is this the 
 right way to do it. Or there can be a better way to do it.

 Regards,
 Ritesh Nanda


 On Monday, 21 April 2014 17:27:21 UTC-6, Ritesh Nanda wrote:

 Hello , 

 I have a custom facts which returns the block devices based on some 
 condition in an array.

  facter | grep arraydev
 arraydev = [sdb, sdc]

 Now i want to use this array in defined type so that a exec resource can 
 run as no. of times elements in the array.

 vi modules/test/manifest/exeecho.pp

 define test::exeecho() {
 exec {echo_${name}:
   command = echo hello  /tmp/foo23,
   path = ['/bin'],
  }
}


 vi modules/test/manifest/init.pp

 class test {
 test::exeecho{$::arraydev:}
 }


 But puppet agent -t run gives a error.

 Error: Could not retrieve catalog from remote server: Error 400 on 
 SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: 
 Invalid resource type exec at /etc/puppetlabs/puppet/
 modules/test/manifests/exeecho.pp:5 on node pzxdcc0002.cdbt.pldc.kp.org
 Warning: Not using cache on failed catalog
 Error: Could not retrieve catalog; skipping run

 Please tell me if i am doing something wrong.

 Regards,
 Ritesh Nanda






  -- 
 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/5f7536a9-a42e-4f1d-b1fe-1b4bda324f51%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/5f7536a9-a42e-4f1d-b1fe-1b4bda324f51%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 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/d858d064-bceb-421d-8db3-9bf75bf4f186%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Package With 'yum' Provider Uses 'rpm' to Remove a Package (bug?)

2014-04-23 Thread Antoine Cotten
Hi Jon,

this is more like a security mechanism to prevent YUM from removing 
dependencies in a very unexpected and unattended way.
From my experience I have already tried to achieve such thing: I wanted to 
get rid of sendmail but this also deleted critical packages such as cron 
(!). Using RPM prevents this to happen by forcing you to explicitly adding 
any package depending on your undesired package to the absent list.
 

On Tuesday, April 22, 2014 9:16:22 PM UTC+2, Jon Forrest wrote:

 (I found a discussion from 6/22/09 on this topic, but that was a long time 
 ago.)

 Using Puppet 3.5.1 on CentOS 6.5 I recently created the following:

   package {
 [ PackageKit]:
   ensure = absent,
   }

 However, when I ran Puppet, I got

 Error: Execution of '/bin/rpm -e PackageKit-0.5.8-21.el6.x86_64' returned 
 1: error: Failed dependencies:
 PackageKit = 0.5.8-21.el6 is needed by (installed) 
 PackageKit-yum-0.5.8-21.el6.x86_64
 PackageKit = 0.5.8-21.el6 is needed by (installed) 
 PackageKit-glib-0.5.8-21.el6.x86_64
 PackageKit is needed by (installed) 
 PackageKit-yum-plugin-0.5.8-21.el6.x86_64

 Notice that the provider is running '/bin/rpm' which explains the errors. 
 So, I explicitly added
 a provider, so that the resource definition is this:

  package {
 [ PackageKit]:
   provider = 'yum',
   ensure = absent,
   }

 There was no change!!

 In the discussion from 2009, somebody suggested using purge instead of 
 absent,
 so I did. But although Puppet now uses yum, it does so in a very strange 
 way:

 Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install 
 PackageKit-purge' returned 1: Error: Nothing to do
 Wrapped exception:

 This looks like a bug to me.

 I ended up using

   exec { /usr/bin/yum -y remove PackageKit:
 onlyif = /bin/rpm -qa |/bin/fgrep PackageKit,
 }

 but this is a step in the wrong direction.

 Comments?

 Jon Forreset



-- 
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/711bfb94-6156-4057-9568-a1decfca90a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Copying files between nodes

2014-04-23 Thread Antoine Cotten
Hi Warden,

Exporting a file resource will not export its content, unless the content 
is part of the resource (ie. using content =  or source = ). By just 
giving a path you will always end-up with an empty file.
I guess a better approach would be to maintain all files somewhere on your 
Puppet master, and them deploy them to your nodes. This even works 
recursively with directories.

Toni



On Wednesday, April 23, 2014 6:00:30 PM UTC+2, warden wrote:

 Hi,

 I am trying to copy files between nodes using exported resources.
 What I want to do is to copy contents of the file from node1 to node2 
 (exactly same location), basicly rsync functionality.

 Here is my scenario:

 node1 and node2 include a common class

 in common.pp i have:
   @@file { filename-${hostname}:
 path = /file/path/somefile,
   }
  
 As I understand this is collecting filename-node1 and filename-node2.
 Then, in node2 I have a line:

 File| title == 'filename-node2' |

 Unfortunately, I get always an empty file on node2. Did I misunderstand 
 the way Exported Resources work?

 Thanks,
 Radek



-- 
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/89e1eba1-d88d-4ea4-941a-061c744d12d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: using custom array based fact with defined type

2014-04-22 Thread Antoine Cotten
Could you please post the result of: validate_array($::arraydev) ?

You need to have the puppetlabs/stdlib module installed

Toni


On Tuesday, April 22, 2014 1:27:21 AM UTC+2, Ritesh Nanda wrote:

 Hello , 

 I have a custom facts which returns the block devices based on some 
 condition in an array.

  facter | grep arraydev
 arraydev = [sdb, sdc]

 Now i want to use this array in defined type so that a exec resource can 
 run as no. of times elements in the array.

 vi modules/test/manifest/exeecho.pp

 define test::exeecho() {
 exec {echo_${name}:
   command = echo hello  /tmp/foo23,
   path = ['/bin'],
  }
}


 vi modules/test/manifest/init.pp

 class test {
 test::exeecho{$::arraydev:}
 }


 But puppet agent -t run gives a error.

 Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
 Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid 
 resource type exec at 
 /etc/puppetlabs/puppet/modules/test/manifests/exeecho.pp:5 on node 
 pzxdcc0002.cdbt.pldc.kp.org
 Warning: Not using cache on failed catalog
 Error: Could not retrieve catalog; skipping run

 Please tell me if i am doing something wrong.

 Regards,
 Ritesh Nanda








-- 
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/01c935f4-a43b-4d4a-945e-2b5ac315775e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Serious performance issues with Puppet 3.5.x when using Directory Environments

2014-04-17 Thread Antoine Cotten
Dear Puppet Users community, I would like to report an issue I experience 
since the first release of Puppet 3.5, and possibly get some input from 
people who face the same problem (if any).


I run a Puppet environment in which all 48 nodes run CentOS 6.5. I have 
been using config file-based environments so far without any trouble. When 
Puppet 3.5.0 was officially released I decided to give give it a try, along 
with the new Directory Environments feature. I disabled my old-style 
environment config while making sure my directory tree was correctly set, 
as described in the Directory Environments documentation 
pagehttp://docs.puppetlabs.com/puppet/latest/reference/environments.html
.

The problem shows up immediately after I restart httpd: Passenger starts 
spawning more and more processes which all consume 25% of my machine CPU, 
reaching a load average of 10+ in less than a minute as soon as the first 
node requests a catalog. This makes the master unusable, it takes between 
200 and 300sec to compile any catalog.


What I have tried:

   1. Switching back from Passenger to WEBrick: same performance issue
   2. Disabling the puppet service on all nodes, and triggering *one*single 
manual Puppet run on a random node: same 
   performance issue
   3. Disabling my external node classifier (Foreman): same performance 
   issue
   4. Upgrading to Puppet 3.5.1: same performance issue
   5. Switching back to config-based environments and re-enabling all nodes: no 
   issue, my master behaves normally and the load-average remains under 0.25 
   constantly

As you might have noticed, this is definitely not a sizing issue. My master 
has 2GB of RAM and 2 allocated vCPU, but the Puppet master rack process 
starts consuming all resources as soon as I re-enable Directory 
Environments.

When I want to use Directory Environments, the only thing I do is 
commenting the [development] and [production] sections in my puppet.conf 
file, and adding this to the [main] section: environmentpath = 
$confdir/environments

Let me describe my configuration:

*-puppet.conf--*
[main]
logdir = /var/log/puppet.
rundir = /var/run/puppet
ssldir = $vardir/ssl
privatekeydir = $ssldir/private_keys { group = service }
hostprivkey = $privatekeydir/$certname.pem { mode = 640 }
autosign   = $confdir/autosign.conf { mode = 664 }

[master]
autosign   = $confdir/autosign.conf { mode = 664 }
reports= foreman
external_nodes = /etc/puppet/node.rb
node_terminus  = exec
ca = true
ssldir = /var/lib/puppet/ssl
storeconfigs = true
storeconfigs_backend = puppetdb

[development]
modulepath = 
/etc/puppet/environments/development/modules:/usr/share/puppet/modules
manifest   = /etc/puppet/environments/development/manifests/site.pp
config_version =
[production]
modulepath = 
/etc/puppet/environments/production/modules:/usr/share/puppet/modules
manifest   = /etc/puppet/environments/production/manifests/site.pp
config_version =

*--*

*--directory tree--*/etc/puppet/environments/
|-- development
|   |-- manifests
|   |   `-- site.pp
|   `-- modules
|   |-- activemq
|   |-- apache
|   |-- apt
|   |-- concat
|   |-- datacat
|   |-- environment
|   |-- epel
|   |-- erlang
|   |-- firewall
|   |-- java
|   |-- java_ks
|   |-- mcollective
|   |-- postfix
|   |-- profiles
|   |-- rabbitmq
|   |-- repos
|   |-- stdlib
|   `-- tomcat
`-- production
|-- manifests
|   `-- site.pp
`-- modules
|-- activemq
|-- apache
|-- apt
|-- concat
|-- datacat
|-- environment
|-- epel
|-- erlang
|-- firewall
|-- inifile
|-- java
|-- java_ks
|-- mcollective
|-- mysql
|-- ntp
|-- postfix
|-- postgresql
|-- profiles
|-- puppetdb
|-- rabbitmq
|-- repos
|-- stdlib
|-- tomcat
`-- vsftpd
*--*



Can anybody reproduce this it on any platform? Thank you in advance for 
your help!

Toni

-- 
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/8036c0fa-57ee-401b-b9d7-03c43dda0fd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.