I may not have been clear..
We don't "currently" use a puppet master, although we are currently
evaluating this, among other options moving forward. The mess I was left
with appears to have absolutely minimal configuration as to just get to
point B as quickly as possible.
So when these instances come up the directory that the modules are
untarred in are just that. A dumping place for the entire puppet repo
since we have no master.
/etc/facter/ doesn't exist at all, while this can be remedied I would think
that the puppet install should have created it. This is why I have been
looking for a directory that I place my facts in that puppet will just
"pickup" and run. The aforementioned fix did not work, the variables I
need were not present and the proper 'versioned' config files did not
install.
Doing an strace revealed that facter never touched /etc/facter/facter.d/ .
This is troubling because it was before.. Puppet is proving to be very
troublesome.
I just need a place to plop down a few .rb files and then let ruby rip the
install up.
On Monday, September 8, 2014 12:58:57 PM UTC-5, Garrett Honeycutt wrote:
>
> On 9/7/14 11:41 AM, omfg9899 wrote:
> > I know I must be missing something stupid, but I have tried for 2 days
> > now without success.
> >
> > I am using puppet stand alone, no master.
> >
> > I need a simple custom fact to be created to assist in deploying the
> > correct configuration at build time.
> > I made this super simple fact..
> >
> > <fact>
> > # envir.rb
> >
> > Facter.add('environment_class') do
> > setcode '/bin/cat /etc/default/environment.info'
> > end
> > </fact>
> >
> > I have placed this file in MANY different places as suggested and it
> > never works. However, if i run facter envir.rb it will stick the fact
> > into the fact list. This fact basically determines if the system is
> > dev/cert or prod and assigns certain configs for various services based
> > on that value. The only thing in the environment.info file is going to
> > be prod or cer or prod.
> > Out of desperation I ran strace to see if it was even looking at the
> > file and to my surprise it was. I was surprised to see that it was
> > infact touching the file but can't understand the output.
> >
> > <output>
> > tat("/etc/facter/facts.d/envir.rb", {st_mode=S_IFREG|0755, st_size=104,
> > ...}) = 0
> > geteuid() = 0
> > getegid() = 0
> > getuid() = 0
> > getgid() = 0
> > access("/etc/facter/facts.d/envir.rb", X_OK) = 0
> > .......
> > open("/etc/facter/facts.d/envir.rb.ttl", O_RDONLY) = -1 ENOENT (No such
> > file or directory)
> > stat("/etc/facter/facts.d/envir.rb", {st_mode=S_IFREG|0755, st_size=104,
> > ...}) = 0
> > rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
> > pipe([5, 6]) = 0
> > futex(0x7f5fe8480a84, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x7f5fe8480a80,
> > {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
> > futex(0x7f5fe8480ab0, FUTEX_WAKE_PRIVATE, 1) = 1
> > clone(child_stack=0,
> > flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
> > child_tidptr=0x7f5fe86b19d0) = 4959
> > rt_sigaction(SIGVTALRM, {0x7f5fe81c74e0, [], SA_RESTORER,
> > 0x7f5fe7f8c4a0}, {0x7f5fe81c74e0, [], SA_RESTORER, 0x7f5fe7f8c4a0}, 8) =
> 0
> > clone(child_stack=0x7f5fe2523ff0,
> >
> flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,
>
>
> > parent_tidptr=0x7f5fe25249d0, tls=0x7f5fe2524700,
> > child_tidptr=0x7f5fe25249d0) = 4960
> > futex(0x7f5fe8480ae4, FUTEX_WAIT_PRIVATE, 7, NULL) = 0
> > futex(0x7f5fe8480ab0, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
> > futex(0x7f5fe8480ab0, FUTEX_WAKE_PRIVATE, 1) = 0
> > close(6) = 0
> > fcntl(5, F_GETFL) = 0 (flags O_RDONLY)
> > ./facter_dot_d.rb:148: command not found: /etc/facter/facts.d/envir.rb
> > </output>
> >
> > Any thoughts?
> >
> > Thanks in advance.
> >
> > J
> >
>
> Hi,
>
> Take a look at external facts[1]. Since your fact is spawning a shell to
> cat a file, you could get the same functionality without the effort of
> maintaining that code.
>
> Given a text file, /etc/facter/facts.d/environment_class.txt with the
> contents
>
> environment_class=some_text
>
> you would have the custom fact 'environment_class' with the value
> 'some_text'.
>
> [1] -
> https://docs.puppetlabs.com/facter/latest/custom_facts.html#external-facts
>
> Best regards,
> -g
>
> --
> Garrett Honeycutt
> @learnpuppet
> Puppet Training with LearnPuppet.com
> Mobile: +1.206.414.8658
>
--
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/1fb49534-287f-4f92-941a-deffb71101bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.