[Puppet Users] Puppet 4 Certification

2017-04-03 Thread muhammadausafaliyousaf
Can anyone guide us on how to prepare for Puppet 4 Certification, like what 
books, links etc to use. Moreover, please suggest materials excluding 
Official training Materials but equal in caliber. Has anyone passed the 4 
exams yet?

-- 
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/919d24a0-84e0-4acc-8286-78b8046a2374%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet 4 Certification

2017-04-03 Thread Martin Alfke
Hi,
> On 03 Apr 2017, at 13:16, muhammadausafaliyou...@gmail.com wrote:
> 
> Can anyone guide us on how to prepare for Puppet 4 Certification, like what 
> books, links etc to use. Moreover, please suggest materials excluding 
> Official training Materials but equal in caliber. Has anyone passed the 4 
> exams yet?

as I am a Puppet Trainer, I must re-certify everytime when Puppet updates the 
questionaire catalog.

I can recommend the learn.puppet.com website with all the free online sessions.
Beside this it is useful to also dig into Puppet Enterprise as some questions 
will deal with PE Console. Best way to do this is using the learning vm from 
Puppet.

Additionally you can go for the following books:
- John Arundel - Puppet Cookbooks (I am unsure whether a Puppet 4 Cookbook is 
available - but basics still fit)
- Martin Alfke (me) and Felix Frank - Puppet 4 Essentials (Basics)
- Jo Rhett - Puppet 4 (Experienced)
- Alessandro Franceschi - Extending Puppet (Experienced)

Best thing you can do: work regular with Puppet.

BTW: there is no specific Puppet 4 certification.
Certification will never expire but has the year of the certification mentioned 
in the title.

hth,
Martin


> 
> 
> -- 
> 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/919d24a0-84e0-4acc-8286-78b8046a2374%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/0EBF77BA-A2CF-4AAD-AE0A-DA4D02243C3A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] How to set noop = true in manifest for custom function?

2017-04-03 Thread staceytian4321
Hi Rob,

Thank you for the reply.

The missing comma is a type in the post. In my actual test, I had the comma.

I figured out how to enable noop = true for my custom function.

I edited my custom function

from
{:name => package, :ensure => "latest"}
to
{:name => package, :noop => true, :ensure => "latest"}

Thanks,
Stacey.

On Saturday, April 1, 2017 at 2:58:15 PM UTC-4, Rob Nelson wrote:
>
> In your second example, you're missing a comma after true. Not sure if 
> that's bad copy pasta or accurate with the source. 
>
> On Sat, Apr 1, 2017 at 12:21 PM > 
> wrote:
>
>> Hi,
>>
>> I am using open source puppet 3.7.3 master and client.
>>
>> I know how to set noop = true in an individual manifest. For example,
>>
>> file { "/tmp/testfile1" :
>>ensure => present,
>>noop => true
>> }
>>
>> Now I am trying a custom function (
>> http://ryanuber.com/11-06-2012/manage-sets-of-packages-in-puppet.html). 
>> This custom function is called "apply_package_list" and accepts tow 
>> arguments.
>>
>> I created a new manifest called "pkgcheck" and placed this 
>> apply_package_list.rb in its folder 
>> /etc/puppet/modules/pkgcheck/lib/puppet/parser/functions/
>>
>> Then I created /etc/puppet/modlues/pkgcheck/manifests/init.pp and 
>> checkpkg.pp.
>>
>> In checkpkg.pp:
>>
>> class pkgcheck::checkpkg inherits pkgcheck  {
>> apply_package_list("/root/packagelist","nopurge") 
>>  }
>>
>> It works fine when I run "puppet agent -t" on my client machine. It will 
>> check what package is missing or with incorrect version, then try to update 
>> that package.
>>
>> Then I tried to use the noop option to disable the update of the package. 
>> I only want to be notified, but don't do anything.
>>
>> class pkgcheck::checkpkg inherits pkgcheck  {
>>   noop => true  
>>   apply_package_list("/root/packagelist","nopurge") 
>>  }
>>
>> It doesn't work and returns error when I ran "puppet agent -t" on client 
>> machine:
>>
>> Error: Could not retrieve catalog from remote server: Error 400 on 
>> SERVER: Syntax error at '=>'; expected '}' at 
>> /etc/puppet/modules/pkgcheck/manifests/checkpkg.pp:6 on node testclient.
>>
>> I also tried with "$noop = true". This will not give syntax error, but it 
>> doesn't have any effect and puppet will still try to update the package.
>>
>> If I run this command on client machine, it works fine:
>> puppet apply --noop -e 'apply_package_list("/root/packagelist", 
>> "nopurge")'
>>
>> Please advise how I can set noop = true for this custom function? This 
>> function has no return value.
>>
>> Thanks,
>> Stacey
>>
>> -- 
>> 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/5b005c57-d25b-42ef-a88b-bc770dbbb7e2%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Rob Nelson 
>

-- 
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/5d8c9010-b8c7-4659-98da-a5e8487b0fb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppet-archive

2017-04-03 Thread Ryan Vande
I posted this in slack puppet community, lets see if I can get more ideas 
here 

I have the following setup

when puppet runs on the agent puppet node, no errors happen but nothing 
else happens either, have a look please 

Im using Puppet Archive for the following 

Puppetfile:
mod 'puppet-archive', '1.3.0'
mod 'puppetlabs-stdlib', '4.16.0'


hieradata/global.yaml:
artifactory_host: artifactory.azcender.com
tripwire::wintripdir: 'c://temp'


Profile:

include ::archive
archive {"${windir}/te_agent_8.4.2_en_windows_x86_64.zip" :
  ensure=> present,
  source=> 
"http://${artifactory_host}/artifactory/application-release-local/gov/usda/fs/busops/cio/Tripwire/te_agent_8.4.2_en_windows_x86_64.zip";,
  extract   => true,
  extract_path  => $windir,
  creates   => $windir,
  cleanup   => false,


Puppet agent runs on the puppet node without error but nothing happens , 
meaning no files are uploaded and extracted to the node 
Any assistance is much appreciated 

-- 
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/3af44cae-11bc-4594-94d6-382fc60a8577%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppet-archive

2017-04-03 Thread Luke Bigum

creates   => $windir,


^^^  I'm fairly certain that this resource won't run if that file exists, 
which is most likely a directory (and does exist). I'd say it has to be 
this:


  creates   => "${windir}/te_agent_8.4.2_en_windows_x86_64.zip"




On Monday, 3 April 2017 15:42:56 UTC+1, Ryan Vande wrote:
>
> I posted this in slack puppet community, lets see if I can get more ideas 
> here 
>
> I have the following setup
>
> when puppet runs on the agent puppet node, no errors happen but nothing 
> else happens either, have a look please 
>
> Im using Puppet Archive for the following 
>
> Puppetfile:
> mod 'puppet-archive', '1.3.0'
> mod 'puppetlabs-stdlib', '4.16.0'
>
>
> hieradata/global.yaml:
> artifactory_host: artifactory.azcender.com
> tripwire::wintripdir: 'c://temp'
>
>
> Profile:
>
> include ::archive
> archive {"${windir}/te_agent_8.4.2_en_windows_x86_64.zip" :
>   ensure=> present,
>   source=> 
> "http://${artifactory_host}/artifactory/application-release-local/gov/usda/fs/busops/cio/Tripwire/te_agent_8.4.2_en_windows_x86_64.zip";,
>   extract   => true,
>   extract_path  => $windir,
>   creates   => $windir,
>   cleanup   => false,
>
>
> Puppet agent runs on the puppet node without error but nothing happens , 
> meaning no files are uploaded and extracted to the node 
> Any assistance is much appreciated 
>

-- 
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/244e9090-31a3-40ab-9a19-59edc77d9b31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppet-archive

2017-04-03 Thread Luke Bigum
Actually no, it's going to need to be some file that's inside the ZIP 
archive, not the name of the ZIP archive itself. You get the idea though.


On Monday, 3 April 2017 15:49:59 UTC+1, Luke Bigum wrote:
>
>
> creates   => $windir,
>
>
> ^^^  I'm fairly certain that this resource won't run if that file exists, 
> which is most likely a directory (and does exist). I'd say it has to be 
> this:
>
>
>   creates   => "${windir}/te_agent_8.4.2_en_windows_x86_64.zip"
>
>
>
>
> On Monday, 3 April 2017 15:42:56 UTC+1, Ryan Vande wrote:
>>
>> I posted this in slack puppet community, lets see if I can get more ideas 
>> here 
>>
>> I have the following setup
>>
>> when puppet runs on the agent puppet node, no errors happen but nothing 
>> else happens either, have a look please 
>>
>> Im using Puppet Archive for the following 
>>
>> Puppetfile:
>> mod 'puppet-archive', '1.3.0'
>> mod 'puppetlabs-stdlib', '4.16.0'
>>
>>
>> hieradata/global.yaml:
>> artifactory_host: artifactory.azcender.com
>> tripwire::wintripdir: 'c://temp'
>>
>>
>> Profile:
>>
>> include ::archive
>> archive {"${windir}/te_agent_8.4.2_en_windows_x86_64.zip" :
>>   ensure=> present,
>>   source=> 
>> "http://${artifactory_host}/artifactory/application-release-local/gov/usda/fs/busops/cio/Tripwire/te_agent_8.4.2_en_windows_x86_64.zip";,
>>   extract   => true,
>>   extract_path  => $windir,
>>   creates   => $windir,
>>   cleanup   => false,
>>
>>
>> Puppet agent runs on the puppet node without error but nothing happens , 
>> meaning no files are uploaded and extracted to the node 
>> Any assistance is much appreciated 
>>
>

-- 
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/27c3ab11-b78c-4c1b-bdcb-0af6317dc0f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] How to send console notice to notify email?

2017-04-03 Thread staceytian4321
Hi,

I am using open source puppet 3.7.3 master and client.

I would like to send the notice output of a manifest to email (I don't want 
to receive email about all manifests' notice, just this special manifest). 

In /etc/puppet/tagmail.conf:
pkgNotSync_notice: myem...@hotmail.com

Then I created a new manifest called "pkgcheck" which will call a custom 
function. This custom function (
http://ryanuber.com/11-06-2012/manage-sets-of-packages-in-puppet.html) is 
called "apply_package_list". It will check what packages are missing or 
with incorrect version. This function accepts two argument and has no 
return value. 

Then I created /etc/puppet/modlues/pkgcheck/manifests/init.pp and 
checkpkg.pp.

In checkpkg.pp, I call this function first, then create a notify resource:

class pkgcheck::checkpkg inherits pkgcheck  {
 
   apply_package_list('/root/packagelist', 'nopurge')
   
   notify { 'packageCheck':
  noop=> true,
  tag => packageNotSync_notice, 
  } 
}

When I ran "puppet agent -t" on my client machine, the console displays 
exactly what two packages are not synced (caironmm-1.0.x86_64 and 
libkkc-0.2.1-9.el7.x86_64):

Notice: /Package[caironmm-1.0.x86_64]/ensure: current_value absent, should 
be latest (noop)
Notice: /Package[libkkc-0.2.1-9.el7.x86_64]/ensure: current_value absent, 
should be latest (noop)
Notice: /Stage[main]/Pkgcheck::Checkpkg/Notify[packageCheck]/message: 
current_value absent, should be packageCheck (noop)

However, in the email I received, it only contains the last line which list 
the overall result:

Mon Apr 03 10:48:25 -0400 2017 
/Stage[main]/Pkgcheck::Checkpkg/Notify[packageCheck]/message (notice): 
current_value absent, should be packageCheck (noop) 

I would like to receive the email which looks the same as what is displayed 
on the console for this manifest. 

Please advise how I can achieve this purpose?

Thanks,
Stacey

-- 
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/f7e6385a-7fed-40cc-bfdb-51b431cd16eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppet-archive

2017-04-03 Thread Ryan Vande
Can you explain further?

As of now, if I dont manually create 
${windir}/te_agent_8.4.2_en_windows_x86_64 which is actually 
c:\temp\te_agent_8.4.2_en_windows_x86_64 it blows up but creates never 
creates it otherwise

If I manual create the directories, the puppet cycle goes without error but 
the zip is never created/extracted to 
c:\temp\te_agent_8.4.2_en_windows_x86_64



On Monday, April 3, 2017 at 9:53:46 AM UTC-5, Luke Bigum wrote:
>
> Actually no, it's going to need to be some file that's inside the ZIP 
> archive, not the name of the ZIP archive itself. You get the idea though.
>
>
> On Monday, 3 April 2017 15:49:59 UTC+1, Luke Bigum wrote:
>>
>>
>> creates   => $windir,
>>
>>
>> ^^^  I'm fairly certain that this resource won't run if that file exists, 
>> which is most likely a directory (and does exist). I'd say it has to be 
>> this:
>>
>>
>>   creates   => "${windir}/te_agent_8.4.2_en_windows_x86_64.zip"
>>
>>
>>
>>
>> On Monday, 3 April 2017 15:42:56 UTC+1, Ryan Vande wrote:
>>>
>>> I posted this in slack puppet community, lets see if I can get more 
>>> ideas here 
>>>
>>> I have the following setup
>>>
>>> when puppet runs on the agent puppet node, no errors happen but nothing 
>>> else happens either, have a look please 
>>>
>>> Im using Puppet Archive for the following 
>>>
>>> Puppetfile:
>>> mod 'puppet-archive', '1.3.0'
>>> mod 'puppetlabs-stdlib', '4.16.0'
>>>
>>>
>>> hieradata/global.yaml:
>>> artifactory_host: artifactory.azcender.com
>>> tripwire::wintripdir: 'c://temp'
>>>
>>>
>>> Profile:
>>>
>>> include ::archive
>>> archive {"${windir}/te_agent_8.4.2_en_windows_x86_64.zip" :
>>>   ensure=> present,
>>>   source=> 
>>> "http://${artifactory_host}/artifactory/application-release-local/gov/usda/fs/busops/cio/Tripwire/te_agent_8.4.2_en_windows_x86_64.zip";,
>>>   extract   => true,
>>>   extract_path  => $windir,
>>>   creates   => $windir,
>>>   cleanup   => false,
>>>
>>>
>>> Puppet agent runs on the puppet node without error but nothing happens , 
>>> meaning no files are uploaded and extracted to the node 
>>> Any assistance is much appreciated 
>>>
>>

-- 
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/491702e1-6abb-4f3b-bead-b3ded33cdfa8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppet-archive

2017-04-03 Thread Luke Bigum
>From the docs at https://github.com/voxpupuli/puppet-archive#reference 
(Resources -> Archive section):

  creates: if file/directory exists, will not download/extract archive.

If you've got a creates parameter with the value of ${windir} (which for 
you is C:\temp\) then the archive resource won't do anything if C:\temp\ 
exists. On a Windows machine I believe there's a very good chance that will 
always exist, hence why your archive is not doing anything.

The creates flag is there to stop the archive resource from running over 
and over again; it specifies a file that will exist AFTER you've downloaded 
and extracted your archive.  Think of it as a conditional to do work or not 
do work.

I've downloaded /te_agent_8.4.2_en_windows_x86_64.zip and looked inside. I 
would suggest you try this parameter:

  creates => "${windir}/te_agent_8.4.2_en_windows_x86_64/te_agent.msi"

-Luke


On Monday, 3 April 2017 16:53:44 UTC+1, Ryan Vande wrote:
>
> Can you explain further?
>
> As of now, if I dont manually create 
> ${windir}/te_agent_8.4.2_en_windows_x86_64 which is actually 
> c:\temp\te_agent_8.4.2_en_windows_x86_64 it blows up but creates never 
> creates it otherwise
>
> If I manual create the directories, the puppet cycle goes without error 
> but the zip is never created/extracted to 
> c:\temp\te_agent_8.4.2_en_windows_x86_64
>
>
>
> On Monday, April 3, 2017 at 9:53:46 AM UTC-5, Luke Bigum wrote:
>>
>> Actually no, it's going to need to be some file that's inside the ZIP 
>> archive, not the name of the ZIP archive itself. You get the idea though.
>>
>>
>> On Monday, 3 April 2017 15:49:59 UTC+1, Luke Bigum wrote:
>>>
>>>
>>> creates   => $windir,
>>>
>>>
>>> ^^^  I'm fairly certain that this resource won't run if that file 
>>> exists, which is most likely a directory (and does exist). I'd say it has 
>>> to be this:
>>>
>>>
>>>   creates   => "${windir}/te_agent_8.4.2_en_windows_x86_64.zip"
>>>
>>>
>>>
>>>
>>> On Monday, 3 April 2017 15:42:56 UTC+1, Ryan Vande wrote:

 I posted this in slack puppet community, lets see if I can get more 
 ideas here 

 I have the following setup

 when puppet runs on the agent puppet node, no errors happen but nothing 
 else happens either, have a look please 

 Im using Puppet Archive for the following 

 Puppetfile:
 mod 'puppet-archive', '1.3.0'
 mod 'puppetlabs-stdlib', '4.16.0'


 hieradata/global.yaml:
 artifactory_host: artifactory.azcender.com
 tripwire::wintripdir: 'c://temp'


 Profile:

 include ::archive
 archive {"${windir}/te_agent_8.4.2_en_windows_x86_64.zip" :
   ensure=> present,
   source=> 
 "http://${artifactory_host}/artifactory/application-release-local/gov/usda/fs/busops/cio/Tripwire/te_agent_8.4.2_en_windows_x86_64.zip";,
   extract   => true,
   extract_path  => $windir,
   creates   => $windir,
   cleanup   => false,


 Puppet agent runs on the puppet node without error but nothing happens 
 , meaning no files are uploaded and extracted to the node 
 Any assistance is much appreciated 

>>>

-- 
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/b91b8640-dd76-4ebb-9dc2-9888098aee34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: puppet-archive

2017-04-03 Thread Ryan Vande
I think I know what you mean if c:\te_agent_8.4.2_en_windows_x86_64 oh nvm 
i get what your saying there is an msi inside the zip so I want it to 
creates = {dir}\flename.msi

On Monday, April 3, 2017 at 10:53:44 AM UTC-5, Ryan Vande wrote:
>
> Can you explain further?
>
> As of now, if I dont manually create 
> ${windir}/te_agent_8.4.2_en_windows_x86_64 which is actually 
> c:\temp\te_agent_8.4.2_en_windows_x86_64 it blows up but creates never 
> creates it otherwise
>
> If I manual create the directories, the puppet cycle goes without error 
> but the zip is never created/extracted to 
> c:\temp\te_agent_8.4.2_en_windows_x86_64
>
>
>
> On Monday, April 3, 2017 at 9:53:46 AM UTC-5, Luke Bigum wrote:
>>
>> Actually no, it's going to need to be some file that's inside the ZIP 
>> archive, not the name of the ZIP archive itself. You get the idea though.
>>
>>
>> On Monday, 3 April 2017 15:49:59 UTC+1, Luke Bigum wrote:
>>>
>>>
>>> creates   => $windir,
>>>
>>>
>>> ^^^  I'm fairly certain that this resource won't run if that file 
>>> exists, which is most likely a directory (and does exist). I'd say it has 
>>> to be this:
>>>
>>>
>>>   creates   => "${windir}/te_agent_8.4.2_en_windows_x86_64.zip"
>>>
>>>
>>>
>>>
>>> On Monday, 3 April 2017 15:42:56 UTC+1, Ryan Vande wrote:

 I posted this in slack puppet community, lets see if I can get more 
 ideas here 

 I have the following setup

 when puppet runs on the agent puppet node, no errors happen but nothing 
 else happens either, have a look please 

 Im using Puppet Archive for the following 

 Puppetfile:
 mod 'puppet-archive', '1.3.0'
 mod 'puppetlabs-stdlib', '4.16.0'


 hieradata/global.yaml:
 artifactory_host: artifactory.azcender.com
 tripwire::wintripdir: 'c://temp'


 Profile:

 include ::archive
 archive {"${windir}/te_agent_8.4.2_en_windows_x86_64.zip" :
   ensure=> present,
   source=> 
 "http://${artifactory_host}/artifactory/application-release-local/gov/usda/fs/busops/cio/Tripwire/te_agent_8.4.2_en_windows_x86_64.zip";,
   extract   => true,
   extract_path  => $windir,
   creates   => $windir,
   cleanup   => false,


 Puppet agent runs on the puppet node without error but nothing happens 
 , meaning no files are uploaded and extracted to the node 
 Any assistance is much appreciated 

>>>

-- 
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/1a710ee6-0af5-443c-9805-38be427a4089%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Webinar on Choria.io and NATS

2017-04-03 Thread Brian Flannery
Hi all..for those of you using Puppet 4, you may find the webinar we are 
doing later in the month with R.I. Pienaar on Choria  
(simplifies 
install/config of MCollective) interesting. 

Just thought I'd share; you can RSVP here: 
http://nats.io/blog/webinar-how-choria-significantly-improves-operability-of-mcollective-using-nats/

B

-- 
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/6089f9a7-8404-432c-b05e-df099019acbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Custom Facts using awk

2017-04-03 Thread warron.french
Wow is that a lot to take in.  I simply need to learn Ruby to cut down on
noise, or so it seems.

Thanks Michael.

--
Warron French


On Thu, Mar 30, 2017 at 12:23 PM, Michael Watters 
wrote:

> %x is a ruby method which captures command output.  IMO you can do most of
> what you need using native ruby methods, there's no need to pipe output to
> grep/sed/awk since ruby has built in pattern matching functions and if
> you're using ruby you might as well do it the ruby way.
>
> For example, this fact uses the =~ operator to do pattern matching on an
> array of strings.
>
> Facter.add(:screen_count) do
> confine :kernel => 'Linux'
> setcode do
> @screens = Facter::Core::Execution.exec("/usr/bin/xrandr -display
> :0").split("\n")
> @screens.count { |x| x =~ /connected/ }
> end
> end
>
> IMO piping grep to awk is never necessary.  awk has a built-in search
> function, just use it!  The command used in that fact could be rewritten as
> follows.
>
>  ethtool_g = %x{ethtool -g #{int} 2>/dev/null  | awk '/^(RX|TX)/ {print
> $2}'}
>
> Still messy and a more native way to do it would be like this.
>
> %x{ethtool -g #{int} 2>/dev/null}.each_line do |line|
> puts line.split("\s")[-1] if line =~ /^(RX|TX):/
> end
>
>
> On Thursday, March 30, 2017 at 11:11:35 AM UTC-4, Warron French wrote:
>>
>> Hi Luke, I have some questions for you.
>>
>> First, the link= https://github.com/puppetlabs/
>> puppetlabs-apache/blob/master/lib/facter/apache_version.rb didn't have
>> any reference to awk at all, was this the file you intended to suggest?
>>
>> Secondly, the link= https://github.com/LMAX-Exchan
>> ge/puppet-networking-example/blob/master/lib/facter/
>> interface_ringbuffer.rb did have a reference to awk; thank you.
>> However, the syntax:
>>   ethtool_g = %x{/sbin/ethtool -g #{int} 2>/dev/null | grep -P
>> '^(RX|TX):' | awk '{print $2}'}
>>
>> Looks like something other than just plain shell scripting, so can you
>> break this down for me just a little bit?
>>
>> I recognize what looks like a variable, called ethtool_g, and then it
>> continues with assignement based on %x{...}  where the "" is your
>> shell scripting.
>>
>> What is the *%x* a reference for/to?  Can I simply replace your variable
>> with one of my own, and your shell scripting between the curly braces with
>> my own shell scripting?
>>
>> Is that legal, and is this in the language of ruby (so I have a reference
>> point of where to go to look up more examples?
>>
>> Sorry for the load of questions.  Thank you for the information.
>>
>> --
>> Warron French
>>
>>
>> On Thu, Mar 30, 2017 at 11:03 AM, warron.french 
>> wrote:
>>
>>> Hey, thanks for the examples Luke!  I am looking at them now.
>>>
>>> --
>>> Warron French
>>>
>>>
>>> On Thu, Mar 30, 2017 at 8:31 AM, Luke Bigum  wrote:
>>>
 Puppet modules on Github are a good source. I've found a simple one:

 https://github.com/puppetlabs/puppetlabs-apache/blob/master/
 lib/facter/apache_version.rb

 And one of my own that's a little more complicated:

 https://github.com/LMAX-Exchange/puppet-networking-example/
 blob/master/lib/facter/interface_ringbuffer.rb

 -Luke

 On Thursday, 30 March 2017 13:10:35 UTC+1, Warron French wrote:
>
> Joshua, thanks for this feedback.  I don't really know ruby; can you
> offer some ideas of where I can find other Puppet Facts written in Ruby
> that don't look like my originally posted example?
>
> Thank you sir.
>
> --
> Warron French
>
>
> On Tue, Mar 28, 2017 at 10:51 AM, Joshua Schaeffer <
> jschaef...@gmail.com> wrote:
>
>> External facts are a Puppet v4 feature only. You have to use Ruby to
>> create custom facts in Puppet v3.
>>
>> On Monday, March 27, 2017 at 3:54:00 PM UTC-6, Warron French wrote:
>>>
>>> OK, done, and done.  But it still isn't showing up.
>>>
>>> Is this potentially because I am using PE-3.8 as a component of Red
>>> Hat Satellite?
>>>
>>> --
>>> Warron French
>>>
>>>
>>> On Mon, Mar 27, 2017 at 5:28 PM, Peter Bukowinski 
>>> wrote:
>>>
 Hi Warron,

 Puppet executes the script directly, so you need the shebang line
 and you must ensure the file is executable.

 -- Peter

 On Mar 27, 2017, at 2:25 PM, warron.french 
 wrote:

 Peter, perhaps I misunderstood you; but, I thought I was supposed
 to be able to use bash or sh scripting to generate facters of my own
 without the use of Ruby.

 The link you provided refers to a python script example.  It also
 adds a shebang line at the top of the script; do I need the shebang 
 line,
 or will Puppet simply execute the shell script with: