Re: [Puppet Users] exporting custom facts to the puppet agents

2013-10-16 Thread Cory Stoker
Well the easiest way would be to make a puppet module and place your
facts in the correct path.  Then enable pluginsync which causes the
fact to get downloaded to the puppet clients.

See:  http://docs.puppetlabs.com/guides/plugins_in_modules.html


On Sun, Oct 13, 2013 at 3:00 AM, Sans  wrote:
>
>
> Dear all,
>
> I have a custom fact, that reads a file and then generate the values
> dynamically based on the file content. It's something like this:
>
>
>> inFile = "/home/admin/OSs.txt"
>> gos = {}
>>
>> if File.exist?(inFile)
>> open(inFile, 'r').each do |line|
>> next if line =~ /^\s*(#|$)/
>> parts = line.split(',').map(&:strip)
>>
>> case parts[1]
>> when /^Mac/
>> (gos[:mac] ||= []) << parts[0]
>> when /_Win$/
>> (gos[:win] ||= []) << parts[0]
>> else
>> (gos[:linux] ||= []) << parts[0]
>> end
>> end
>> end
>>
>> Facter.add(:am_running_oss) do
>> has_weight 100
>> if gos.count >= 1
>> setcode { gos.keys.join(',') }
>> else
>> setcode { 'undefined' }
>> end
>> end
>
>
>
> The file is on the PuppetMaster. Hence the custom fact 'am_running_oss' is
> not available or empty when it runs on the agent. What are the options I
> have to make the custom facts(s) available on every single puppet agent?
> Thanks in advance. Cheers!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.

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


[Puppet Users] exporting custom facts to the puppet agents

2013-10-13 Thread Sans


Dear all,

I have a custom fact, that reads a file and then generate the values 
dynamically based on the file content. It's something like this:


inFile = "/home/admin/OSs.txt"
> gos = {} 
>
> if File.exist?(inFile)
> open(inFile, 'r').each do |line|
> next if line =~ /^\s*(#|$)/
> parts = line.split(',').map(&:strip)
>
> case parts[1]
> when /^Mac/
> (gos[:mac] ||= []) << parts[0]
> when /_Win$/
> (gos[:win] ||= []) << parts[0]
> else
> (gos[:linux] ||= []) << parts[0]
> end
> end
> end
>
> Facter.add(:am_running_oss) do
> has_weight 100
> if gos.count >= 1
> setcode { gos.keys.join(',') }
> else
> setcode { 'undefined' }
> end
> end
>


The file is on the PuppetMaster. Hence the custom fact 'am_running_oss' is 
not available or empty when it runs on the agent. What are the options I 
have to make the custom facts(s) available on every single puppet agent? 
Thanks in advance. Cheers!! 

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