Re: [Puppet Users] Re: Why the copied file on client site will not be recovered from server?

2015-10-14 Thread Wei Chen
Hi,

If I not using any option, but simply as follow, it works, i.g. the agent 
will kept running:

puppet agent


But I could remember, I ran 'puppet agent -t' before and it works. I am not 
sure if  I remember wrong?


What is the difference between these? Maybe the option '-t' is just for 
onetime?

-- 
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/ccfbd24e-a298-41c8-b01f-9c2a5daf09eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet saying "changed 'stopped' to 'running'" while the service is running

2015-10-14 Thread Eddie Mashayev
Hi All,

I have some wired problem with my module to manage MacAfee services. 
My lab have around 150 servers and 145 of them works fine with the module 
I’ve created. 
There are 5 which shows these changes all the time although the service is 
in running state already.

[root@pingapp ~]# service cma status 
cma (pid 1497) is running... 
[root@pingapp ~]# puppet agent -t 
Info: Retrieving pluginfacts 
Info: Retrieving plugin 
Info: Loading facts 
Info: Loading facts 
Info: Caching catalog for il-pingapp-lp1.imperva.local 
Info: Applying configuration version '1444807950' 
Notice: /Stage[main]/Mcafee/Service[cma]/ensure: ensure changed 'stopped' 
to 'running' 
Info: /Stage[main]/Mcafee/Service[cma]: Unscheduling refresh on Service[cma] 
Notice: Finished catalog run in 1.80 seconds 


My module is very simple: 
class mcafee {
if $check_nails_exsist  == 'true' {

  service { 'nails':
ensure => "stopped",
enable => false,
hasstatus  => false,
hasrestart => false,
  }
}
else {
  service { 'nails':
ensure => "running",
enable => true,
hasstatus  => false,
hasrestart => true,
}
  service { 'cma':
ensure => "running",
enable => true,
hasstatus  => false,
hasrestart => true,
  }
}
}


As I said in 145 servers with this module works fine according to the if 
statement and another 5 servers shows the "changed 'stopped' to 'running'" 
I checked this thread https://projects.puppetlabs.com/issues/9798 but it 
didn’t help me. 

Any suggestions for this weird behavior?

Thanks,
EddieM

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2efd3bf1-a218-4c67-b652-d4d227492c99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Why the copied file on client site will not be recovered from server?

2015-10-14 Thread Wei Chen
And here is the puppet.conf on agent side. I haven't changed it except 
moving the server definition to the [agent]:

]# cat puppet.conf
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion.  Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration.  An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig

server=s001ap38-test

-- 
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/b3d812e1-3ab7-48c2-b293-38483949744b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] PuppetDB Service Won't Install/Start

2015-10-14 Thread Ken Barber
On Tue, Oct 13, 2015 at 11:13 PM, Dan  wrote:
> Excellent thanks guys that got me going on the right path looking at the
> certs.  I'm using puppet apply to build the initial puppet master so the
> agent won't have executed when it gets to installing puppetdb so I'll need
> to work around this somehow.
>
> Dan

Use puppet cert generate to make the certs before building your master
perhaps? ie. take the step the master normally does for you out of
band, and do it yourself. afaik its own certificate generation steps
are totally reproducible. If you're building masters from scratch its
good to have control of this step anyway, since you often want to
manage the CA.

> On Friday, 9 October 2015 21:01:00 UTC+1, Ken Barber wrote:
>>
>> On Fri, Oct 9, 2015 at 4:35 AM, Dan  wrote:
>> > Hi Wyatt,
>> >
>> > Thanks for the pointer!  I found the full stack trace which gives a
>> > better
>> > error:
>> >
>> > I just need to workout how to configure the SSL configuration now.
>>
>> Try `puppetdb ssl-setup` on the command line. It requires that you've
>> done a full puppet agent run first, since it re-uses Puppet's SSL
>> certs/key files. Otherwise, you can create new ones manually using the
>> `puppet cert` tooling:
>> https://docs.puppetlabs.com/references/4.2.0/man/cert.html. Just be
>> mindful that normal SSL validation rules apply here with the
>> certificate hostnames. So you must match the real clients hostname,
>> much like a browser, or the client will reject the server.
>>
>> >
>> >
>> > 2015-10-09 20:28:24,184 INFO  [p.p.pdb-routing] Starting PuppetDB,
>> > entering
>> > maintenance mode
>> > 2015-10-09 20:28:24,257 INFO  [p.t.s.n.nrepl-service] nREPL service
>> > disabled, not starting
>> > 2015-10-09 20:28:24,258 INFO  [p.t.s.w.jetty9-service] Starting web
>> > server(s).
>> > 2015-10-09 20:28:24,293 ERROR [p.t.internal] Error during service
>> > start!!!
>> > java.lang.IllegalArgumentException: Missing some SSL configuration; must
>> > provide either :ssl-cert, :ssl-key, and :ssl-ca-cert, OR :truststore,
>> > :trust-password, :keystor
>> > e, and :key-password.
>> > at
>> >
>> > puppetlabs.trapperkeeper.services.webserver.jetty9_config$eval28763$get_jks_keystore_config_BANG___28764$fn__28768.invoke(jetty9_config.clj:288)
>> > ~[na:na]
>> > at
>> >
>> > puppetlabs.trapperkeeper.services.webserver.jetty9_config$eval28763$get_jks_keystore_config_BANG___28764.invoke(jetty9_config.clj:282)
>> > ~[na:na]
>> > at
>> >
>> > puppetlabs.trapperkeeper.services.webserver.jetty9_config$eval28787$get_keystore_config_BANG___28788$fn__28789.invoke(jetty9_config.clj:307)
>> > ~[na:na]
>> > at
>> >
>> > puppetlabs.trapperkeeper.services.webserver.jetty9_config$eval28787$get_keystore_config_BANG___28788.invoke(jetty9_config.clj:300)
>> > ~[na:na]
>> > at
>> >
>> > puppetlabs.trapperkeeper.services.webserver.jetty9_config$eval28963$maybe_get_https_connector__28964$fn__28965.invoke(jetty9_config.clj:399)
>> > ~[na:na]
>> > at
>> >
>> > puppetlabs.trapperkeeper.services.webserver.jetty9_config$eval28963$maybe_get_https_connector__28964.invoke(jetty9_config.clj:390)
>> > ~[na:na]
>> > at
>> >
>> > puppetlabs.trapperkeeper.services.webserver.jetty9_config$eval29004$maybe_add_https_connector__29005$fn__29006.invoke(jetty9_config.clj
>> >
>> >
>> > Thanks
>> >
>> > Dan
>> >
>> > On Friday, 9 October 2015 01:18:08 UTC+1, Wyatt Alt wrote:
>> >>
>> >> Hey Dan,
>> >>
>> >> I see the bottom of a java stacktrace in your log snippet there --
>> >> could
>> >> you get the full stacktrace from journalctl and stick it in a gist?
>> >>
>> >> Wyatt
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Puppet Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to puppet-users...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/puppet-users/03974e18-839d-4aab-bddc-f4c42a9928c7%40googlegroups.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/b5e6cbdc-02c8-49a9-8d66-a0aa0373e85f%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAE4bNT%3DE0csKma9kZH%2B5gn0qLAZevb5%2B4nXo4QrunO%2BWEZJtTw%40mail.gmail.com.
For more options, visit https://gr

Re: [Puppet Users] Re: Puppet 3.8 to 4.2 migration issue...

2015-10-14 Thread Jakov Sosic

On 10/13/2015 05:07 PM, R.I.Pienaar wrote:


You can test all your yamls like:

for i in $(find /etc/puppetlabs/code/hieradb -name \*.yaml)
do
   /opt/puppetlabs/puppet/bin/ruby -r yaml -e "YAML.load(File.read('$i')) && 
puts('$i: OK') rescue puts('$i: NOT OK')"
done

change /etc/puppetlabs/code/hieradb to your hiera dir


Yeah that's it!
I've fixed my yamls and everything is fine on that ground now.


But, I have new issues:

Error: Could not retrieve catalog from remote server: Error 400 on 
SERVER: Evaluation Error: Error while evaluating a Function Call, 
undefined method `sub' for 
Logstash::Configfile[]{:name=>""}:Puppet::Resource at 
/etc/puppetlabs/code/environments/production/modules/helpers/manifests/logstash.pp:19:28 
on node xxx



This is the snippet:

  include ::logstash

  # load configs from hiera
  $logstash_configs = hiera_hash('logstash::configfiles', undef)
  if ($logstash_configs) { create_resources(::Logstash::Configfile, 
$logstash_configs) }

  $logstash_patterns = hiera_hash('logstash::patternfiles', undef)
  if ($logstash_patterns) { create_resources(::Logstash::Patternfile, 
$logstash_patterns) }



And this is from hiera:

logstash::configfiles:
  'input_header':
content: "input {\n"
order:   11
  'input_postfix':
template: 'helpers/logstash/inputs/mongodb.erb'
order:   12
...


I have general problem with importing hashes from yaml in manifests... 
It's bombing out on other stuff too...


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


Re: [Puppet Users] Re: Puppet 3.8 to 4.2 migration issue...

2015-10-14 Thread Jakov Sosic

On 10/14/2015 02:06 PM, Jakov Sosic wrote:


   # load configs from hiera
   $logstash_configs = hiera_hash('logstash::configfiles', undef)
   if ($logstash_configs) { create_resources(::Logstash::Configfile,
$logstash_configs) }
   $logstash_patterns = hiera_hash('logstash::patternfiles', undef)
   if ($logstash_patterns) { create_resources(::Logstash::Patternfile,
$logstash_patterns) }


And this is from hiera:

logstash::configfiles:
   'input_header':
 content: "input {\n"
 order:   11
   'input_postfix':
 template: 'helpers/logstash/inputs/mongodb.erb'
 order:   12


Ah, I only lowered case and it seems it works:


if ($logstash_configs) { create_resources(::logstash::configfile, 
$logstash_configs) }


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


Re: [Puppet Users] Re: Why the copied file on client site will not be recovered from server?

2015-10-14 Thread jcbollinger


On Wednesday, October 14, 2015 at 2:39:02 AM UTC-5, Wei Chen wrote:
>
> Hi,
>
> If I not using any option, but simply as follow, it works, i.g. the agent 
> will kept running:
>
> puppet agent
>
>
> But I could remember, I ran 'puppet agent -t' before and it works. I am 
> not sure if  I remember wrong?
>
>
> What is the difference between these? Maybe the option '-t' is just for 
> onetime?
>
>

Yes, the '-t' option is shorthand for a collection of several others, one 
of which is '--onetime'.  It absolutely implies *not* running as a daemon.


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/7bfdd9ca-9bbc-4ed1-9b18-26874288a1ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Puppet saying "changed 'stopped' to 'running'" while the service is running

2015-10-14 Thread jcbollinger


On Wednesday, October 14, 2015 at 2:51:42 AM UTC-5, Eddie Mashayev wrote:
>
> Hi All,
>
> I have some wired problem with my module to manage MacAfee services. 
> My lab have around 150 servers and 145 of them works fine with the module 
> I’ve created. 
> There are 5 which shows these changes all the time although the service is 
> in running state already.
>
> [root@pingapp ~]# service cma status 
> cma (pid 1497) is running... 
> [root@pingapp ~]# puppet agent -t 
> Info: Retrieving pluginfacts 
> Info: Retrieving plugin 
> Info: Loading facts 
> Info: Loading facts 
> Info: Caching catalog for il-pingapp-lp1.imperva.local 
> Info: Applying configuration version '1444807950' 
> Notice: /Stage[main]/Mcafee/Service[cma]/ensure: ensure changed 'stopped' 
> to 'running' 
> Info: /Stage[main]/Mcafee/Service[cma]: Unscheduling refresh on Service[
> cma] 
> Notice: Finished catalog run in 1.80 seconds 
>
>
> My module is very simple: 
> class mcafee {
> if $check_nails_exsist  == 'true' {
>
>   service { 'nails':
> ensure => "stopped",
> enable => false,
> hasstatus  => false,
> hasrestart => false,
>   }
> }
> else {
>   service { 'nails':
> ensure => "running",
> enable => true,
> hasstatus  => false,
> hasrestart => true,
> }
>   service { 'cma':
> ensure => "running",
> enable => true,
> hasstatus  => false,
> hasrestart => true,
>   }
> }
> }
>
>
> As I said in 145 servers with this module works fine according to the if 
> statement and another 5 servers shows the "changed 'stopped' to 'running'" 
> I checked this thread https://projects.puppetlabs.com/issues/9798 but it 
> didn’t help me. 
>
> Any suggestions for this weird behavior?
>
>
Your Service resources look wrong.  In the event that your services have no 
status command, you must not only set the `hasstatus` parameter to `false`, 
but also specify a status-check command manually via the `status` 
parameter.  Having done one but not the other, you leave Puppet with no way 
to determine whether the service is already running.  I'm not sure how 
Puppet will handle that, but ultimately, it's a flaw in your manifest.

I guess the agents you are managing are running Windows.  Are they running 
the same version of the Puppet agent?  It may be that different versions 
handle the flaws in your manifest differently.

Also, the default Service provider for Windows *does* claim to provide a 
'status' command for all services, but on the other hand does not claim to 
provide a 'restart' command.  Your Service declarations specify differently 
on both points, for reasons that are unclear to me.  I talked about status 
already.  I suspect the restart issue is being cleaned up for you 
internally by the provider; perhaps that's what the unusual 
message "Unscheduling refresh on Service[cma]" is about.

I'm inclined to say that you should remove the declared `hasstatus' and 
'hasrestart' properties from all the Service declarations, as I see no 
reason why it would be appropriate to override their default values in your 
case.  If you nevertheless continue to set 'hasstatus' to 'false', however, 
then you must provide a command via the 'status' parameter that Puppet will 
use to determine whether the service is already running.  See the docs 

 
for more details.


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/b2d5150d-2af7-4242-98dc-9d87d6143f52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Creating multiple directories based on variables or array

2015-10-14 Thread jcbollinger

On Tuesday, October 13, 2015 at 12:20:05 PM UTC-5, Ugo Bellavance wrote:
>
> Hi,
>
> I'd need to create a number of directories in a fasion similar to that:
>
> /var/extlogs/$stage/$client-$application
>
> For example, if stages are integration, staging, production and clients 
> are client1 and client2 (there are many morem in reality), I'd like to have 
> puppet create
>
> /var/extlogs/integration/client1-application1
> /var/extlogs/integration/client1-application2
> /var/extlogs/integration/client2-application1
> /var/extlogs/integration/client2-application2
> /var/extlogs/staging/client1-application1
> /var/extlogs/staging/client1-application2
> /var/extlogs/staging/client2-application1
> /var/extlogs/staging/client2-application2
> /var/extlogs/production/client1-application1
> /var/extlogs/production/client1-application2
> /var/extlogs/production/client2-application1
> /var/extlogs/production/client2-application1
>
> I've created a class that eases the job:
>


Well no, you've created a defined type.  It's very important to understand 
the difference.

 

>
> define lsyncd::createdestdirs (
>
> $application  = '',
> $client   = '',
> $envstage = '',
>
> ) {
>
>
>   file {
> '/var/extlogs':
>   ensure => directory,
>   owner  => "root",
>   group  => "root",
>   mode   => 0755,
>   }
>
>

This is not actually working for you as written.  At least, not for more 
than one combination of 'application', 'client', and 'envstage' per node.  
You would end up with duplicate declarations at least of 
File['/var/extlogs'], at least.

 

>   file {
> "/var/extlogs/${envstage}":
>   ensure => directory,
>   owner  => "root",
>   group  => "root",
>   mode   => 0755,
>   require => File['/var/extlogs'],
>   }
>
>

Note that although it is by no means wrong to declare that dependency on 
the parent directory, Puppet will generate it automatically for you if you 
omit it.  I rely on that in my example code below.

 

> [...] would there be a way to have all the directories created in one 
> directive, by setting $application, $client, and $stage in an array?
>
>

So you want to create a directory for every combination of $application, 
$client, and $stage values?  Historically, that sort of thing has been 
difficult, but there are good ways to handle it in modern Puppet.

 

> I'm currently using puppet 2.7.25 and I'm not using hiera or puppetdb.
>
>

Unfortunately, you're stuck in "historically".  *Way back* in 
"historically", in fact: the latest Puppet is 4.2.  This problem can still 
be handled, but it's not as clean or easy.  Moreover, although puppetdb is 
not really relevant to the question, Hiera is.  In Puppet 2.7, you have 
four alternatives for providing data for your classes to operate upon (your 
various 'client', etc. arrays):

   - you can build the data directly into your classes; or
   - you can parameterize your classes and use resource-like class 
   declarations; or
   - you can look up your data via an external service, with hiera() and 
   extlookup() being the most common; or
   - you can declare them as variables in a scope visible from your class, 
   such as at node scope or even top scope.
   
Use of resource-like class declarations has *always* been problematic, ever 
since parameterized classes were first introduced.  There are a few 
specialized cases were it is relatively safe, but I rarely recommend 
resource-like class declarations to anyone.  Since Puppet 2 provided no 
alternative, parameterized classes were very problematic until the 
introduction of automated data binding (via Hiera) in Puppet 3.

Extlookup() does not provide for structured data (e.g. arrays), and you're 
not using Hiera.  If you want to be able to have different nodes with 
different clients, stages, or applications, then you cannot encode these 
data directly into the class that uses them.

Let's say, therefore, that you will declare

$applications = [ 'application1', 'application2' ]
$clients  = [ 'client1', 'client2' ]
$envstages= [ 'integration', 'staging', 'production' ]

at top scope.  You could do that via an ENC, but you could also just put 
such variable definitions in your site.pp or any other manifest `import'ed 
by it.  You might then have a class (really a class) that manages the 
overall directory set, a defined type whose multiple instances will each 
manage one of the stage directories, and a helper defined type whose 
instances manage the ultimate directories for each stage:

class lsyncd::destdirs {
  $basedir = '/var/extlogs'

  # resource defaults save a bit of typing:
  File {
  owner  => 'root',
  group  => 'root',
  mode   => '0755'
  }

  # The overall base directory
  file { $basedir: ensure => 'directory' }

  # Since (if) $envstages is an array, this declares one
  # lsyncd::stagedir for each element:
  lsyncd::stagedir { ${envstages}: basedir => $basedir }
}

define lsyncd::stagedir($b

Re: [Puppet Users] Re: Creating multiple directories based on variables or array

2015-10-14 Thread Ugo Bellavance
Thanks for your awesome, complete answer John.

Ugo

On Wed, Oct 14, 2015 at 10:12 AM, jcbollinger 
wrote:

>
> On Tuesday, October 13, 2015 at 12:20:05 PM UTC-5, Ugo Bellavance wrote:
>>
>> Hi,
>>
>> I'd need to create a number of directories in a fasion similar to that:
>>
>> /var/extlogs/$stage/$client-$application
>>
>> For example, if stages are integration, staging, production and clients
>> are client1 and client2 (there are many morem in reality), I'd like to have
>> puppet create
>>
>> /var/extlogs/integration/client1-application1
>> /var/extlogs/integration/client1-application2
>> /var/extlogs/integration/client2-application1
>> /var/extlogs/integration/client2-application2
>> /var/extlogs/staging/client1-application1
>> /var/extlogs/staging/client1-application2
>> /var/extlogs/staging/client2-application1
>> /var/extlogs/staging/client2-application2
>> /var/extlogs/production/client1-application1
>> /var/extlogs/production/client1-application2
>> /var/extlogs/production/client2-application1
>> /var/extlogs/production/client2-application1
>>
>> I've created a class that eases the job:
>>
>
>
> Well no, you've created a defined type.  It's very important to understand
> the difference.
>
>
>
>>
>> define lsyncd::createdestdirs (
>>
>> $application  = '',
>> $client   = '',
>> $envstage = '',
>>
>> ) {
>>
>>
>>   file {
>> '/var/extlogs':
>>   ensure => directory,
>>   owner  => "root",
>>   group  => "root",
>>   mode   => 0755,
>>   }
>>
>>
>
> This is not actually working for you as written.  At least, not for more
> than one combination of 'application', 'client', and 'envstage' per
> node.  You would end up with duplicate declarations at least of
> File['/var/extlogs'], at least.
>
>
>
>>   file {
>> "/var/extlogs/${envstage}":
>>   ensure => directory,
>>   owner  => "root",
>>   group  => "root",
>>   mode   => 0755,
>>   require => File['/var/extlogs'],
>>   }
>>
>>
>
> Note that although it is by no means wrong to declare that dependency on
> the parent directory, Puppet will generate it automatically for you if you
> omit it.  I rely on that in my example code below.
>
>
>
>> [...] would there be a way to have all the directories created in one
>> directive, by setting $application, $client, and $stage in an array?
>>
>>
>
> So you want to create a directory for every combination of $application,
> $client, and $stage values?  Historically, that sort of thing has been
> difficult, but there are good ways to handle it in modern Puppet.
>
>
>
>> I'm currently using puppet 2.7.25 and I'm not using hiera or puppetdb.
>>
>>
>
> Unfortunately, you're stuck in "historically".  *Way back* in
> "historically", in fact: the latest Puppet is 4.2.  This problem can still
> be handled, but it's not as clean or easy.  Moreover, although puppetdb is
> not really relevant to the question, Hiera is.  In Puppet 2.7, you have
> four alternatives for providing data for your classes to operate upon (your
> various 'client', etc. arrays):
>
>- you can build the data directly into your classes; or
>- you can parameterize your classes and use resource-like class
>declarations; or
>- you can look up your data via an external service, with hiera() and
>extlookup() being the most common; or
>- you can declare them as variables in a scope visible from your
>class, such as at node scope or even top scope.
>
> Use of resource-like class declarations has *always* been problematic,
> ever since parameterized classes were first introduced.  There are a few
> specialized cases were it is relatively safe, but I rarely recommend
> resource-like class declarations to anyone.  Since Puppet 2 provided no
> alternative, parameterized classes were very problematic until the
> introduction of automated data binding (via Hiera) in Puppet 3.
>
> Extlookup() does not provide for structured data (e.g. arrays), and
> you're not using Hiera.  If you want to be able to have different nodes
> with different clients, stages, or applications, then you cannot encode
> these data directly into the class that uses them.
>
> Let's say, therefore, that you will declare
>
> $applications = [ 'application1', 'application2' ]
> $clients  = [ 'client1', 'client2' ]
> $envstages= [ 'integration', 'staging', 'production' ]
>
> at top scope.  You could do that via an ENC, but you could also just put
> such variable definitions in your site.pp or any other manifest `import'ed
> by it.  You might then have a class (really a class) that manages the
> overall directory set, a defined type whose multiple instances will each
> manage one of the stage directories, and a helper defined type whose
> instances manage the ultimate directories for each stage:
>
> class lsyncd::destdirs {
>   $basedir = '/var/extlogs'
>
>   # resource defaults save a bit of typing:
>   File {
>   owner  => 'root',
>   group  => 'root',
>   mode   => '0755'
> 

[Puppet Users] Re: Puppet saying "changed 'stopped' to 'running'" while the service is running

2015-10-14 Thread Eddie Mashayev
Hi, 

Thanks for the response. 
I removed the `hasstatus' and 'hasrestart' from my module and still the 
same result. 
By the way, my agents are only CentOS 5/6/7.

Thanks,
EddieM

On Wednesday, October 14, 2015 at 4:07:31 PM UTC+3, jcbollinger wrote:
>
>
>
> On Wednesday, October 14, 2015 at 2:51:42 AM UTC-5, Eddie Mashayev wrote:
>>
>> Hi All,
>>
>> I have some wired problem with my module to manage MacAfee services. 
>> My lab have around 150 servers and 145 of them works fine with the module 
>> I’ve created. 
>> There are 5 which shows these changes all the time although the service 
>> is in running state already.
>>
>> [root@pingapp ~]# service cma status 
>> cma (pid 1497) is running... 
>> [root@pingapp ~]# puppet agent -t 
>> Info: Retrieving pluginfacts 
>> Info: Retrieving plugin 
>> Info: Loading facts 
>> Info: Loading facts 
>> Info: Caching catalog for il-pingapp-lp1.imperva.local 
>> Info: Applying configuration version '1444807950' 
>> Notice: /Stage[main]/Mcafee/Service[cma]/ensure: ensure changed 'stopped' 
>> to 'running' 
>> Info: /Stage[main]/Mcafee/Service[cma]: Unscheduling refresh on Service[
>> cma] 
>> Notice: Finished catalog run in 1.80 seconds 
>>
>>
>> My module is very simple: 
>> class mcafee {
>> if $check_nails_exsist  == 'true' {
>>
>>   service { 'nails':
>> ensure => "stopped",
>> enable => false,
>> hasstatus  => false,
>> hasrestart => false,
>>   }
>> }
>> else {
>>   service { 'nails':
>> ensure => "running",
>> enable => true,
>> hasstatus  => false,
>> hasrestart => true,
>> }
>>   service { 'cma':
>> ensure => "running",
>> enable => true,
>> hasstatus  => false,
>> hasrestart => true,
>>   }
>> }
>> }
>>
>>
>> As I said in 145 servers with this module works fine according to the if 
>> statement and another 5 servers shows the "changed 'stopped' to 'running'" 
>> I checked this thread https://projects.puppetlabs.com/issues/9798 but it 
>> didn’t help me. 
>>
>> Any suggestions for this weird behavior?
>>
>>
> Your Service resources look wrong.  In the event that your services have 
> no status command, you must not only set the `hasstatus` parameter to 
> `false`, but also specify a status-check command manually via the `status` 
> parameter.  Having done one but not the other, you leave Puppet with no way 
> to determine whether the service is already running.  I'm not sure how 
> Puppet will handle that, but ultimately, it's a flaw in your manifest.
>
> I guess the agents you are managing are running Windows.  Are they running 
> the same version of the Puppet agent?  It may be that different versions 
> handle the flaws in your manifest differently.
>
> Also, the default Service provider for Windows *does* claim to provide a 
> 'status' command for all services, but on the other hand does not claim to 
> provide a 'restart' command.  Your Service declarations specify differently 
> on both points, for reasons that are unclear to me.  I talked about status 
> already.  I suspect the restart issue is being cleaned up for you 
> internally by the provider; perhaps that's what the unusual 
> message "Unscheduling refresh on Service[cma]" is about.
>
> I'm inclined to say that you should remove the declared `hasstatus' and 
> 'hasrestart' properties from all the Service declarations, as I see no 
> reason why it would be appropriate to override their default values in your 
> case.  If you nevertheless continue to set 'hasstatus' to 'false', however, 
> then you must provide a command via the 'status' parameter that Puppet will 
> use to determine whether the service is already running.  See the docs 
> 
>  
> for more details.
>
>
> 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/7a4f646f-131d-429b-a838-da7d0b06c521%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: The right way to create Hiera resources?

2015-10-14 Thread Marc Teale


On Thursday, October 8, 2015 at 8:31:05 AM UTC-7, jcbollinger wrote:
>
>
>
> On Wednesday, October 7, 2015 at 4:07:29 PM UTC-5, Marc Teale wrote:
>>
>> Is there a right/approved/standard way to create hiera resources for 
>> forge modules that don't do it on their own?  (This is a question about the 
>> right way to structure my Puppet code.  I'm not asking how to use 
>> hiera_create_resources.)
>>
>
>
> Ok, but it's still not clear what you *are* asking.  The term "hiera 
> resource" is not meaningful, so I can only guess at what you mean when you 
> ask about creating one.  My first guesses at what it means to "create hiera 
> resource would involve you editing your Hiera data files, however, which is 
> not ordinarily something to which Puppet code structure has any relevance.  
> So what in the world are you talking about?
>

>  
>
>>
>> To create resources from hiera definitions in the past, I've used wrapper 
>> classes, the quickshiftn-hiera class (an abandoned fork of hunner-hiera 
>> that creates hiera resources without defining them in manifests), and small 
>> class I wrote to do the job.  None of them work all that well. 
>>
>>
>
> Are you asking about how to write Puppet code that declares resources with 
> identities and properties drawn from your Hiera data?
>
>  
>
>> Let me give you an example of the structuring problem I'm running into:
>>
>> Say I want to install Elasticsearch.  I go to the forge, I install the 
>> module, I include the class in Hiera, and define an instance, like so:
>>
>> ---
>> classes:
>>   - 'elasticsearch'
>>
>>  
>>
>> elasticsearch::ensure: 'present'
>> elasticsearch::manage_repo: true
>> elasticsearch::repo_version: '1.7'
>> elasticsearch::instance:
>>   'elasticsearch': {}
>>
>>
>>  Elasticsearch installs, but no instance is created because the 
>> elasticsearch-elasticsearch module doesn't create any hiera resources.  So, 
>> what's the right way to create the instance?
>>
>
>
> It's still not clear what, specifically, you are asking.  Hiera is just a 
> data service.  Site and machine data are very important for using Puppet 
> effectively, and Hiera therefore plays a central role, but in the end it's 
> still just a data service.  You cannot declare resources with Hiera, nor 
> can you declare classes.  The example data you present has no inherent 
> *effect* at all -- it's just data.
>
> Much of the data is, however, structured in a way that will be meaningful 
> to the catalog builder under certain circumstances.  It also contains data 
> that match up with a common convention by which manifests can use Hiera 
> data to determine which classes to declare.  But these are properties of 
> how the data are used, not of the data themselves.
>
> I guess in the end the question you are posing seems likely to fall into 
> one of two general categories:
>
>1. How to write Puppet manifest code that can make effective use of 
>Hiera data to declare resources, or
>2. How to write Puppet code that declares resources based on specific 
>data you have already in hand.
>
> Neither of those seems complete, however, inasmuch as one normally needs 
> to design manifests and data together.  Moreover, there is no one approach 
> that is ideal for every circumstance and person.  We can talk about this in 
> the context of a specific example -- maybe elasticsearch -- but that needs 
> to start with your requirements for the resulting configuration of target 
> nodes, and any implementation requirements / preferences you may have.  If 
> you have existing manifest code (even if it's just 
> hiera_include('classes'))  and data to start with then that might be 
> helpful both as a starting point and to further clarify what you're after.
>
>
> John
>
>
I'm asking about the latter category.

The problem I'm facing is that Hiera defines a resource, but a lot of forge 
modules don't create resources from that definition on their own.  (Using 
elastisearch was a bad example.  After I posted I saw that the module 
actually does create hiera resources.)

So here's the scenario:

   - I've downloaded the foobar module from the forge.
   - I've defined a foobar::instance in Hiera.
   - The module doesn't create resources from Hiera definitions.
   - The module doesn't have a means to include custom classes within it, 
   so it can't be extended to create the resources without making changes to 
   manifests.  

So I'm asking if there's a best practices method of creating foobar instances 
from Hiera definitions, be it in another module that does nothing but run 
create_resources(foobar::instance), modifying the module and then 
submitting a pull request, or...?

Thanks,
Marc

-- 
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/ms

Re: [Puppet Users] Re: The right way to create Hiera resources?

2015-10-14 Thread Ramin K

On 10/14/15 12:33 PM, Marc Teale wrote:


So I'm asking if there's a best practices method of creating foobar
instances from Hiera definitions, be it in another module that does
nothing but run create_resources(foobar::instance), modifying the module
and then submitting a pull request, or...?

Thanks,
Marc


	The community answer so far has been to wrap it in a profile class. A 
wrapper classes solves the problem of the lookup for creating the 
instances and anything else that might need to be done per instance that 
is unique to your environment.


	I did a talk earlier this year talking about what goes into profile 
classes and what problems they solve. Full txt of the talk is also in 
the repo.


https://github.com/rkhatibi/sipmug-feb2015/blob/master/Role-Profile-%20What%20goes%20in%20the%20profile%20part.pdf

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/561EB5CC.4050108%40badapple.net.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: The right way to create Hiera resources?

2015-10-14 Thread Marc Teale
That's very helpful.  Thank you.

On Wednesday, October 14, 2015 at 1:06:54 PM UTC-7, Ramin K wrote:
>
> On 10/14/15 12:33 PM, Marc Teale wrote: 
>
> > So I'm asking if there's a best practices method of creating foobar 
> > instances from Hiera definitions, be it in another module that does 
> > nothing but run create_resources(foobar::instance), modifying the module 
> > and then submitting a pull request, or...? 
> > 
> > Thanks, 
> > Marc 
>
> The community answer so far has been to wrap it in a profile 
> class. A 
> wrapper classes solves the problem of the lookup for creating the 
> instances and anything else that might need to be done per instance that 
> is unique to your environment. 
>
> I did a talk earlier this year talking about what goes into 
> profile 
> classes and what problems they solve. Full txt of the talk is also in 
> the repo. 
>
>
> https://github.com/rkhatibi/sipmug-feb2015/blob/master/Role-Profile-%20What%20goes%20in%20the%20profile%20part.pdf
>  
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f6c82ae6-22c1-4ae5-83e9-bb5d021240ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Making a Provider API Call Idempotent

2015-10-14 Thread Danny Roberts
In a custom type/provider I am writing it seems that the provider is not 
entirely idempotent.

The provider 
(https://github.com/kemra102/puppet-githubapi/blob/master/lib/puppet/provider/github_repo/default.rb)
 
is calling the Github API (https://developer.github.com/v3/repos/#edit) and 
amending an attribute that is a boolean on the API side is what is causing 
the issue.

The API always returns a boolean value as expected however the Puppet 
provider converts the boolean value provided to a symbol and presumably it 
is this that is causing the value to always be modified even if for example 
it is already the value specified in the resource.

Notice: Compiled catalog for iacon.cybertron.local in environment 
production in 0.06 seconds
FalseClass
{"name"=>"apitest", "has_wiki"=>:false}
Symbol
Notice: /Stage[main]/Main/Github_repo[apitest]/has_wiki: has_wiki changed 
'false' to 'false'
Notice: Finished catalog run in 2.51 seconds

In the above I added some cheap and dirty debugging which shows;

FalseClass = This is the value returned by the GitHub API.
{"name"=>"apitest", "has_wiki"=>:false} - The values being sent in the body 
of the request to the GitHub API.
Symbol - As is probably clear this is the class of the 'has_wiki' value.

Any ideas how to correctly match up these values and not cause an 
unrequired update?

-- 
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/b847246d-13d1-4f00-8058-6cc71567e908%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Announce: PuppetDB 2.3.8 has been released!

2015-10-14 Thread Wyatt Alt
PuppetDB 2.3.8  October 14, 2015

PuppetDB 2.3.8 Downloads



Available in native package format in the release repositories at:

http://yum.puppetlabs.com and http://apt.puppetlabs.com

For information on how to enable the Puppet Labs repos, see:

http://docs.puppetlabs.com/guides/puppetlabs_package_repositories.html#open-source-repositories

Binary tarball: http://downloads.puppetlabs.com/puppetdb/

Source: http://github.com/puppetlabs/puppetdb

Please report feedback via the Puppet Labs tickets site, using an affected
PuppetDB version of 2.3.8: https://tickets.puppetlabs.com/browse/PDB

Documentation: http://docs.puppetlabs.com/puppetdb/2.3/

Puppet module: http://forge.puppetlabs.com/puppetlabs/puppetdb

PuppetDB 2.3.8 Release Notes



PuppetDB 2.3.8 is a backwards-compatible bugfix release that fixes an issue
where simultaneous updates to large numbers of fact values could produce a
prepared statement that exceeded the max allowed by the Postgres JDBC
driver. See https://tickets.puppetlabs.com/browse/PDB-2003 for details.

For more information and upgrade advice, consult the detailed release notes
here:

https://docs.puppetlabs.com/puppetdb/2.3/release_notes.html

Contributors


Ken Barber, Ryan Senior, Wyatt Alt

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


[Puppet Users] Install puppet 4.0 on centos 7?

2015-10-14 Thread anton kropp
I feel like I'm missing something super obvious here but I'm trying to 
install puppet 4.0 on centos 7 and the only packages i can see are 3.8.3. 
 When I check the repo https://yum.puppetlabs.com/el/7/products/x86_64/ 
there is no 4.0 puppet-server package?  Can someone help steer me in the 
right direction?

-- 
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/dfc74b4f-6b10-4249-9a79-146f6d5f0497%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Install puppet 4.0 on centos 7?

2015-10-14 Thread Christopher Wood
Look here:

https://yum.puppetlabs.com/el/7/PC1/x86_64/

Also this thing:

https://puppetlabs.com/blog/welcome-puppet-collections


On Wed, Oct 14, 2015 at 03:17:57PM -0700, anton kropp wrote:
>I feel like I'm missing something super obvious here but I'm trying to
>install puppet 4.0 on centos 7 and the only packages i can see are 3.8.3.
> When I check the repo https://yum.puppetlabs.com/el/7/products/x86_64/
>there is no 4.0 puppet-server package?  Can someone help steer me in the
>right direction?
> 
>--
>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 [1]puppet-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>
> [2]https://groups.google.com/d/msgid/puppet-users/dfc74b4f-6b10-4249-9a79-146f6d5f0497%40googlegroups.com.
>For more options, visit [3]https://groups.google.com/d/optout.
> 
> References
> 
>Visible links
>1. mailto:puppet-users+unsubscr...@googlegroups.com
>2. 
> https://groups.google.com/d/msgid/puppet-users/dfc74b4f-6b10-4249-9a79-146f6d5f0497%40googlegroups.com?utm_medium=email&utm_source=footer
>3. 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/20151014234913.GA5255%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Install puppet 4.0 on centos 7?

2015-10-14 Thread Charlie Sharpsteen
On Wednesday, October 14, 2015 at 6:18:33 PM UTC-5, anton kropp wrote:
>
> I feel like I'm missing something super obvious here but I'm trying to 
> install puppet 4.0 on centos 7 and the only packages i can see are 3.8.3. 
>  When I check the repo https://yum.puppetlabs.com/el/7/products/x86_64/ 
> there is no 4.0 puppet-server package?  Can someone help steer me in the 
> right direction?
>

Starting with Puppet 4, releases are grouped into repositories known as 
"package collections". This allows us to create a new collection repository 
when breaking changes happen. For CentOS 7 x86_64, you'll want to pull 
packages from the "PC1" repository:

 https://yum.puppetlabs.com/el/7/PC1/x86_64/

This can repo can be configured by installing the following package from 
the root of yum.puppetlabs.com:

  https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fd695f7d-ac93-408e-ad6b-40fa82ee6bf6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] how to generate puppet modules or manifests files according to different groups of servers dynamically?

2015-10-14 Thread Robert Chen
hi all,

my company has a huge number of servers which are doing different 
functionalities and these are changing everyday.  I want to make the 
customers to customized their requirements in a YAML file and then generate 
puppet manifests for modules dynamically. 

For example, a new groups of servers are coming to CMDB, then they make the 
configuration requirements in a YAML file. Then I write a script to convert 
YAML to puppet modules or manifests. Nothing is certain.  Probably 
different function put into different git repositories, like SiteLogin, 
 SiteRegistration, SiteCheckout...? 

Anyone has this experience or please share your idea. 

thanks,
Robert

-- 
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/09a18afe-771e-4ec2-b160-5ebb10b4dddc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] file absent in config manifest fails

2015-10-14 Thread Tim Dunphy
Hey guys,

 On puppet server 3.8.2 here. And I have a file definition that I want to
set as 'absent'. For example, this is what I have:

  file { '/etc/newrelic/newrelic.cfg':
ensure  => absent,
path=> '/etc/newrelic/newrelic.cfg',
content => template('newrelic/newrelic.cfg.erb'),
before  => Service[$newrelic_php_service],
notify  => Service[$newrelic_php_service],
  }

And if I remove the file I want on the target host:

[root@ops3:~] #rm -fv /etc/newrelic/newrelic.cfg
removed ‘/etc/newrelic/newrelic.cfg’

And then run the puppet agent again:

[root@ops3:~] #puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Could not retrieve fact='nr_java_found', resolution='':
undefined method `start_with?' for nil:NilClass
Info: Caching catalog for ops3.jokefire.com
Info: Applying configuration version '1444874991'
*Notice:
/Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]/ensure:
created*
Info: /Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]:
Scheduling refresh of Service[newrelic-daemon]
Notice: /Stage[main]/Newrelic::Agent::Php/Service[newrelic-daemon]:
Triggered 'refresh' from 1 events
Notice: /Stage[main]/Mcollective::Service/Service[mcollective]/ensure:
ensure changed 'stopped' to 'running'
Info: /Stage[main]/Mcollective::Service/Service[mcollective]: Unscheduling
refresh on Service[mcollective]
Notice: /Stage[main]/Apache::Service/Service[httpd]/ensure: ensure changed
'stopped' to 'running'
Info: /Stage[main]/Apache::Service/Service[httpd]: Unscheduling refresh on
Service[httpd]
Notice: /Stage[main]/Puppet::Service/Service[puppet]/ensure: ensure changed
'stopped' to 'running'
Info: /Stage[main]/Puppet::Service/Service[puppet]: Unscheduling refresh on
Service[puppet]
Notice: Finished catalog run in 7.17 seconds

Notice the newrelic.cfg file that I want to be 'absent' is created
nontheless.

Is this some kind of flaw in the version of puppet I'm using? Or could I be
doing something wrong?

Because this is not at all the way I understand the 'absent' value of the
ensure setting is supposed to work!

I guess in the meantime I can comment out the file definition entirely. But
I would like to understand why the 'absent' setting isn't working the way
it's supposed to!

Thanks,
Tim

-- 
GPG me!!

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

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOZy0en%3DUXeKADyRgNprhpM5jjkcQdJO4H8y8PcqULxAFVsz%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] file absent in config manifest fails

2015-10-14 Thread Peter Bukowinski
Tim,

> On Oct 14, 2015, at 10:14 PM, Tim Dunphy  wrote:
> 
> Hey guys,
> 
>  On puppet server 3.8.2 here. And I have a file definition that I want to set 
> as 'absent'. For example, this is what I have:
> 
>   file { '/etc/newrelic/newrelic.cfg':
> ensure  => absent,
> path=> '/etc/newrelic/newrelic.cfg',
> content => template('newrelic/newrelic.cfg.erb'),
> before  => Service[$newrelic_php_service],
> notify  => Service[$newrelic_php_service],
>   }

If you specify 'ensure => absent' then you should not have a 'content' line. 
They are contradictory parameters. (Also, but unrelated, the path parameter is 
duplicative since specifying the path as the file resource name serves the same 
purpose.)

> And if I remove the file I want on the target host:
> 
> [root@ops3:~] #rm -fv /etc/newrelic/newrelic.cfg
> removed ‘/etc/newrelic/newrelic.cfg’
> 
> And then run the puppet agent again:
> 
> [root@ops3:~] #puppet agent --test
> Info: Retrieving pluginfacts
> Info: Retrieving plugin
> Info: Loading facts
> Could not retrieve fact='nr_java_found', resolution='': undefined 
> method `start_with?' for nil:NilClass
> Info: Caching catalog for ops3.jokefire.com 
> Info: Applying configuration version '1444874991'
> Notice: 
> /Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]/ensure: 
> created
> Info: /Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]: 
> Scheduling refresh of Service[newrelic-daemon]
> Notice: /Stage[main]/Newrelic::Agent::Php/Service[newrelic-daemon]: Triggered 
> 'refresh' from 1 events
> Notice: /Stage[main]/Mcollective::Service/Service[mcollective]/ensure: ensure 
> changed 'stopped' to 'running'
> Info: /Stage[main]/Mcollective::Service/Service[mcollective]: Unscheduling 
> refresh on Service[mcollective]
> Notice: /Stage[main]/Apache::Service/Service[httpd]/ensure: ensure changed 
> 'stopped' to 'running'
> Info: /Stage[main]/Apache::Service/Service[httpd]: Unscheduling refresh on 
> Service[httpd]
> Notice: /Stage[main]/Puppet::Service/Service[puppet]/ensure: ensure changed 
> 'stopped' to 'running'
> Info: /Stage[main]/Puppet::Service/Service[puppet]: Unscheduling refresh on 
> Service[puppet]
> Notice: Finished catalog run in 7.17 seconds
> 
> Notice the newrelic.cfg file that I want to be 'absent' is created 
> nontheless. 
> 
> Is this some kind of flaw in the version of puppet I'm using? Or could I be 
> doing something wrong?
> 
> Because this is not at all the way I understand the 'absent' value of the 
> ensure setting is supposed to work!
> 
> I guess in the meantime I can comment out the file definition entirely. But I 
> would like to understand why the 'absent' setting isn't working the way it's 
> supposed to!
> 
> Thanks,
> Tim

-- 
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/266E9C53-C845-474F-B3AD-54CA5D3D86B1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] file absent in config manifest fails

2015-10-14 Thread Tim Dunphy
>
> If you specify 'ensure => absent' then you should not have a 'content'
> line. They are contradictory parameters. (Also, but unrelated, the path
> parameter is duplicative since specifying the path as the file resource
> name serves the same purpose.)


Ok! Gothca. Actually not to deflect blame, but I didn't author this
manifest. I downloaded it from puppet forge for the newrelic module.

But the real problem I found out was that they duplicated the file
definition in two separate manifests. It was listed in:

Class: newrelic::php
environments/production/modules/newrelic/manifests/php.pp

And

Class: newrelic::agent::php
environments/production/modules/newrelic/manifests/agent/php.pp

Not sure how they did that and got away with it, since I thought you could
only define a resource once in a module.

But making the file absent by doing this in both files:

$newrelic_daemon_cfgfile_ensure= 'absent',

  file { '/etc/newrelic/newrelic.cfg':
ensure  => $newrelic_daemon_cfgfile_ensure,
path=> '/etc/newrelic/newrelic.cfg',
content => template('newrelic/newrelic.cfg.erb'),
before  => Service[$newrelic_php_service],
notify  => Service[$newrelic_php_service],
  }

Is what worked. Also, I may go ahead and change the manifests per your
advice, but that's more of a style issue than a functional one I think.

Thanks!!
Tim

On Wed, Oct 14, 2015 at 10:24 PM, Peter Bukowinski  wrote:

> Tim,
>
> On Oct 14, 2015, at 10:14 PM, Tim Dunphy  wrote:
>
> Hey guys,
>
>  On puppet server 3.8.2 here. And I have a file definition that I want to
> set as 'absent'. For example, this is what I have:
>
>   file { '/etc/newrelic/newrelic.cfg':
> ensure  => absent,
> path=> '/etc/newrelic/newrelic.cfg',
> content => template('newrelic/newrelic.cfg.erb'),
> before  => Service[$newrelic_php_service],
> notify  => Service[$newrelic_php_service],
>   }
>
>
> If you specify 'ensure => absent' then you should not have a 'content'
> line. They are contradictory parameters. (Also, but unrelated, the path
> parameter is duplicative since specifying the path as the file resource
> name serves the same purpose.)
>
> And if I remove the file I want on the target host:
>
> [root@ops3:~] #rm -fv /etc/newrelic/newrelic.cfg
> removed ‘/etc/newrelic/newrelic.cfg’
>
> And then run the puppet agent again:
>
> [root@ops3:~] #puppet agent --test
> Info: Retrieving pluginfacts
> Info: Retrieving plugin
> Info: Loading facts
> Could not retrieve fact='nr_java_found', resolution='':
> undefined method `start_with?' for nil:NilClass
> Info: Caching catalog for ops3.jokefire.com
> Info: Applying configuration version '1444874991'
> *Notice:
> /Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]/ensure:
> created*
> Info: /Stage[main]/Newrelic::Agent::Php/File[/etc/newrelic/newrelic.cfg]:
> Scheduling refresh of Service[newrelic-daemon]
> Notice: /Stage[main]/Newrelic::Agent::Php/Service[newrelic-daemon]:
> Triggered 'refresh' from 1 events
> Notice: /Stage[main]/Mcollective::Service/Service[mcollective]/ensure:
> ensure changed 'stopped' to 'running'
> Info: /Stage[main]/Mcollective::Service/Service[mcollective]: Unscheduling
> refresh on Service[mcollective]
> Notice: /Stage[main]/Apache::Service/Service[httpd]/ensure: ensure changed
> 'stopped' to 'running'
> Info: /Stage[main]/Apache::Service/Service[httpd]: Unscheduling refresh on
> Service[httpd]
> Notice: /Stage[main]/Puppet::Service/Service[puppet]/ensure: ensure
> changed 'stopped' to 'running'
> Info: /Stage[main]/Puppet::Service/Service[puppet]: Unscheduling refresh
> on Service[puppet]
> Notice: Finished catalog run in 7.17 seconds
>
> Notice the newrelic.cfg file that I want to be 'absent' is created
> nontheless.
>
> Is this some kind of flaw in the version of puppet I'm using? Or could I
> be doing something wrong?
>
> Because this is not at all the way I understand the 'absent' value of the
> ensure setting is supposed to work!
>
> I guess in the meantime I can comment out the file definition entirely.
> But I would like to understand why the 'absent' setting isn't working the
> way it's supposed to!
>
> Thanks,
> Tim
>
>
> --
> 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/266E9C53-C845-474F-B3AD-54CA5D3D86B1%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
GPG me!!

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

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiv

Re: [Puppet Users] Re: Forge ACL Module 1.1.1 on Windows 7 x64 SP1

2015-10-14 Thread Rob Reynolds
On Thu, Oct 1, 2015 at 8:09 AM, jmp242  wrote:

> Puppet 3.8.1 on Windows currently. puppet module list doesn't return
> anything for me. I'm downloading the zip file and unzipping the module into
> a folder. I then copy the folder into my local dev modules directory using
> Geppeto, and doing the same for any dependencies. I then check into our SVN
> the modules, and tag them with the version they are from forge if public,
> or an internal version for our custom modules. I then check out the tag or
> svn switch to the latest tag on the puppet server dev module directory.
>

Ah okay. I'm wondering what might cause issues surrounding 3.8.1 and ACL
provider. An ACE with the same structure 142 times though, I'm wondering if
there is a memory issue there.


>
> On Wednesday, September 30, 2015 at 3:38:49 PM UTC-4, Rob Reynolds wrote:
>>
>> Thanks. I'm surprised that a 'puppet agent --trace --debug --verbose'
>> didn't turn up any more information about the error.
>>
>> Can you remind me again what version of Puppet you have installed?
>>
>> And the modules, `puppet module list`. How are you installing these
>> modules by the way?
>>
>> On Tue, Sep 29, 2015 at 2:43 PM, jmp242  wrote:
>>
>> Sure, that's perhaps misleading a little - our internal custom puppet
>> module is called yum as it was created for EL6 first. When we got a package
>> manager on Windows, i.e. chocolatey, it seemed to make sense to put it in
>> the Windows section of the yum module. By that I mean we have a switch on
>> kernel in our modules. Here's the complete module:
>> class yum ($choco_repo_url, $choco_repo_name) {
>>   schedule { 'monday_updates':
>> range   => '22:00 - 12:00',
>> weekday => 'Monday',
>>   }
>>
>>   schedule { 'tuesday_updates':
>> range   => '10:00 - 12:00',
>> weekday => 'Tuesday',
>>   }
>>
>>   schedule { 'daily_updates':
>> period => daily,
>> range  => '22:00-3:00',
>>   }
>>
>>   define repo {
>> file { "${title}":
>>   path   => "/etc/yum.repos.d/${title}",
>>   source => "puppet:///modules/${caller_module_name}/${title}",
>>   ensure => 'present',
>>   owner  => root,
>>   group  => root,
>>   mode   => "644",
>>   notify => Exec["yum-clean-all"],
>> }
>>
>>   }
>>
>>   case $kernel {
>> 'linux'   : {
>>   package { 'yum': ensure => present, }
>>
>>   package { 'yum-autoupdate': ensure => present, }
>>
>>   repo { "sl-classe.repo": }
>>
>>   file { "sl-classe-testing":
>> content => template('yum/sl-classe-testing.repo.erb'),
>> path=> "/etc/yum.repos.d/sl-classe-testing.repo",
>> owner   => root,
>> group   => root,
>> mode=> 644,
>> ensure  => present,
>> notify  => Exec["yum-clean-all"],
>>   }
>>
>>   file { "yum.conf":
>> source => "puppet:///modules/yum/yum.conf",
>> path   => "/etc/yum.conf",
>> owner  => root,
>> group  => root,
>> mode   => 644,
>> ensure => present,
>>   }
>>
>>   file { "sl-lepp":
>> path   => "/etc/yum.repos.d/sl-lepp.repo",
>> ensure => absent,
>>   }
>>
>>   file { "sl-lepp-testing":
>> path   => "/etc/yum.repos.d/sl-lepp-testing.repo",
>> ensure => absent,
>>   }
>>
>>   exec { "yum-clean-all":
>> command => "yum clean all",
>> refreshonly => true,
>>   }
>>
>>   case $operatingsystemmajrelease {
>> '6' : {
>>   $sl6repos = ["devtoolset.repo", "sl-other.repo", "sl.repo"]
>>
>>   repo { $sl6repos: }
>>
>>   file { "softwarecollections":
>> source =>
>> "puppet:///modules/yum/sl6-softwarecollections.repo",
>> path   => "/etc/yum.repos.d/softwarecollections.repo",
>> owner  => root,
>> group  => root,
>> mode   => 644,
>> ensure => present,
>> notify => Exec["yum-clean-all"],
>>   }
>>
>>   exec { "yum-autoupdate":
>> command => "mv /etc/cron.daily/yum-autoupdate
>> /etc/cron.weekly/yum-autoupdate",
>> onlyif  => "[ -f /etc/cron.daily/yum-autoupdate ]",
>>   }
>>
>>   file { "/etc/cron.daily/yum-autoupdate": ensure => absent, }
>>
>>   file { "/etc/cron.weekly/yum-autoupdate": ensure => present, }
>>   Exec['yum-autoupdate'] -> File['/etc/cron.daily/yum-autoupdate'
>> ] -> File['/etc/cron.weekly/yum-autoupdate']
>>
>> }
>> '7' : {
>>   packages::removepackage { "yum-conf-sl7x": }
>>
>>   $sl7repos = [
>> "sl7-other.repo",
>> "sl7.repo",
>> "sl-extras.repo",
>> "sl7-security.repo",
>> "sl7-fastbugs.repo",
>> "sl7-rolling.repo",
>> "sl7-testing.repo"]
>>
>>   repo { $sl7repos: }
>>
>>   file { "softwarecollections":
>> source =>
>> "puppet:///modules/yum/sl7-softwarecollections.r

Re: [Puppet Users] Re: Puppet 3.8 to 4.2 migration issue...

2015-10-14 Thread Thomas Müller
I would recommend you to run puppet-lint against all your manifests. It will 
detect other possible problems. 

- 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9df7d523-2e7d-4a77-ac42-69d47d989c2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet command through MCollective are extremely slow

2015-10-14 Thread Malintha Adikari
Hi,

I have configured puppet master and set of agent. When I issue "puppet 
agent -vt" catalog run command from agents directly, it takes millisecond 
scale time to complete that operation(very less time). Then I configured 
MCollective to orchestrate this process. I installed MCollective server on 
each agent and MCollective client in separate machine and configured 
ActiveMQ as the message broker in the middle of MCollective client and 
servers. It was also working fine. But now the process has become extremely 
slow. When I issue

mco puppet runall 10

Command from MCollective client,  it takes more than 7 minutes to run 
catalogs in all agents. I monitored puppet master machine /var/logs/syslog 
and seems it takes 5 minutes to start puppet runs from the initial 
MCollective command. 

What is the root cause for this issue. Is this an issue related to ActiveMQ 
?


-- 
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/e7f9a655-6527-46bb-840e-98e326453463%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Why the copied file on client site will not be recovered from server?

2015-10-14 Thread Wei Chen
Many thanks for your patience and 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/4cf051d2-fcf0-407e-8258-5d6c69ba3559%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.