Hi Santanu,

custom facts should always do their work inside a setcode block.
http://docs.puppetlabs.com/guides/custom_facts.html

That has nothing to do with the issue at hand, however.

If you need the file to exist before puppet's first run, have your
provisioning system lay it down. Otherwise, you'll have the situation
you're describing where your first puppet run's job is to set the stage for
the rest of your runs.

hth

W





On Sun, Oct 13, 2013 at 6:30 AM, Sans <r.santanu....@gmail.com> wrote:

> To solve my "copying file" issue, I can certainly have a file{} type like
> this:
>
> file { 'running_oss':
>>     name    => '/home/admin/OSs.txt',
>>     mode    => '0644',
>>     content => file('/home/admin/OSs.txt');
>> }
>>
>
> to copy the file from the Master to the agent, but as "Retrieving plugin" 
> stuff
> happens way before anything else, the file is not copied prior to the
> custom fact. So, I need to run puppet twice to get the custom fact working
> on a freshly installed agent.
>
> -San
>
>
>
>
> On Sunday, October 13, 2013 11:39:22 AM UTC+1, Sans wrote:
>>
>> .....well, unless I'm missing something here.
>>
>> -Santanu
>>
>>
>>
>> On Sunday, October 13, 2013 11:37:19 AM UTC+1, Sans wrote:
>>>
>>> Hi Martin,
>>>
>>> That doesn't actually work: I thought exactly the same in the beginning
>>> and already have the pluginsync enabled. I think, the reason being, the
>>> fact (am_running_oss.rb) file itself reads a text file and the file should
>>> be local. When it runs on the agent, the file (inFile =
>>> "/home/admin/OSs.txt")is there for the .rb file to read it, hence the
>>> fact returns 'undefined'as well.
>>>
>>> -San
>>>
>>>
>>>
>>>
>>>
>>> On Sunday, October 13, 2013 11:18:46 AM UTC+1, Martin Alfke wrote:
>>>>
>>>> Hi,
>>>>
>>>> On 13.10.2013, at 10:57, Sans <r.sant...@gmail.com> wrote:
>>>>
>>>> > [...]
>>>>
>>>> > 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 have to put the fact inside the lib/facter directory of a module
>>>> and you have to enable pluginsync on all nodes puppet.conf.
>>>> http://docs.puppetlabs.com/**guides/plugins_in_modules.html<http://docs.puppetlabs.com/guides/plugins_in_modules.html>
>>>>
>>>> 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 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.

Reply via email to