I accomplish this through a way that may fit your needs. I use facters for 
it. Here is one for looking for Apache on Debian-based distro:

 

Facter.add(:apache_exists) do

confine :osfamily => "Debian"

setcode do

if Facter::Util::Resolution.exec("dpkg -l | grep apache2 | grep -v 
> apache2-utils | grep ^ii")

"true"

end

end

end


This shows up in PuppetDB and Puppet Dashboard as "apache_exists", and 
"true" for systems that have it.

Here is one for looking for the version of SEP on a Windows server:
 

> Facter.add("app_sep_version") do
>
>   confine :osfamily => "Windows"
>
> setcode do
>
> Facter::Util::Resolution.exec('C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe
>  
>> -Command "& {Get-ChildItem 
>> hklm:\software\microsoft\windows\currentversion\uninstall | ForEach-Object 
>> {Get-ItemProperty $_.pspath} | Where-Object {$_.DisplayName -eq \"Symantec 
>> Endpoint Protection\"} | ForEach-Object -process {$_.DisplayVersion } }" ' )
>
> end
>
> end
>
>
That one reports the version of SEP to both Puppet DB, and Puppet Dashboard.


I hope this helps,
Brian 


On Sunday, October 26, 2014 4:47:04 PM UTC-7, Robin Powell wrote:
>
>
> So I've been using puppet for a long time, and the one thing I've 
> never solved to my satisfaction is a way to have a single source of 
> truth that acts as both instructions to puppet *and* as a system 
> inventory that I can use for general opertaions (i.e. "how many 
> tomcat hosts do we have?"). 
>
> When Hiera came along I shifted to that, believing that it was the 
> right solution here, and I've managed to hack together something 
> that works, but it's pretty inelegant.  The reason is that to get a 
> proper inventory out of hiera requires collating all the hiera data 
> from the point of view of each host, so that all the hierarchical 
> processing is correct, and then mushing all those results together. 
> I've got a system to do that, but it's pretty hacky. 
>
> Is there some better way of combining a general inventory system and 
> puppet?  Is this a Puppet Enterprise sort of thing? 
>
> -- 
> http://intelligence.org/ :  Our last, best hope for a fantastic future. 
> .i ko na cpedu lo nu stidi vau loi jbopre .i dafsku lu na go'i li'u .e 
> lu go'i li'u .i ji'a go'i lu na'e go'i li'u .e lu go'i na'i li'u .e 
> lu no'e go'i li'u .e lu to'e go'i li'u .e lu lo mamta be do cu sofybakni 
> li'u 
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3b7f0966-df19-49e1-b50b-c1b20304f4f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to