Questions tagged [facter]

Facter is an independent, cross-platform Ruby library bundled with Puppet, designed to gather basic node information about the hardware and operating system

Developed by Puppet Labs to help with automated system configuration management. A puppet manifest declares the required state of the machine. Facter retrieves the current state, so that Puppet can work out what changes need to be made, and how.

The Facter gem can be used by any Ruby system, without the rest of Puppet.

117 questions
0
votes
1 answer

only use certain modules from my module_path in vagrant puppet

Not experienced with puppet and vagrant. We used to have all the puppet settings in a big puppet repository and our vagrant instance worked fine. Recently, to have things better isolated so they are not rolled out accidentally, we have a certain…
gigi2
  • 1,996
  • 1
  • 17
  • 22
0
votes
1 answer

How do I retrieve a fact and use it to store a custom value in a variable in Puppet?

I have a script where I retrieve the IP address from a machine and then perform some logical operations to decide what value to give to a variable. Then, I use this value to make some decisions about the environment the machine is working in. I am…
EGS
  • 409
  • 4
  • 23
0
votes
0 answers

puppetdb stringify structured facts like hashes

I have a Problem with puppetdb and my structured facts (hashes). Hashes will stringified through my puppetdb. Ubuntu 14.04 puppetserver = 3.8.7 facter = 2.4.4 puppetdb = 2.3.8-1 In my puppet.conf on the clients and server i…
mobios
  • 353
  • 1
  • 2
  • 7
0
votes
1 answer

Deploying a custom fact only to clients running a given module

I am trying to write a custom fact for linux servers that will give me all the folders under certain folder. The catch is that I need it to be deployed only on the the clients running the module that contains the fact -- it must not be deployed to…
Afik.A
  • 73
  • 1
  • 8
0
votes
1 answer

How do I use C to get the kenv settings from FreeBSD

I'm trying to improve Facter on FreeBSD. Previously this was Ruby code, so it was fairly easy to grok as a Ruby programmer. Since Facter's 3.X release it's mainly shifted to C/C++ for performance. During this shift, it's lost some facts, such as on…
Peter Souter
  • 5,110
  • 1
  • 33
  • 62
0
votes
1 answer

Puppet stringify facts

I have a problem with puppet and facter. puppet --version -> 3.8.6 facter --version -> 2.4.6 I write a fact for softwareinventory with returnvalue a nested hash like this: apps = { 'Notepad++' => { 'Displayname' =>…
mobios
  • 353
  • 1
  • 2
  • 7
0
votes
1 answer

Puppet pass a fact into a double-quoted line of code in an ERB file

I'm sure the answer to this is straightforward, but I can't find out how to do this. I have a line in my erb template file that needs to write exactly as-is into a server's config file (for OpenVPN): push "dhcp-option DNS 192.16.23.12" I need to…
HelenH
  • 55
  • 3
  • 8
0
votes
1 answer

How to create folder name with custom facts using puppet in Windows?

I wrote a custom fact to create current date and time in windows.That facts return the current date and time when i notifying it. Eg: notify{"test time": message=>"$::windows_time", } output of above code is…
0
votes
1 answer

How to schedule puppet custom facts to execute every X hours?

I have a custom puppet fact (written in ruby) which executes a simple bash script. The script checks all files in the file system for world-readable permissions and returns results accordingly. The puppet fact checks the output of the script and…
amirb
  • 387
  • 3
  • 8
0
votes
1 answer

Using a puppet/facter fact in a Foreman smart class parameter?

How can I use a puppet/facter fact like ${$::hostname} in a Foreman smart class parameter? I've tried $hostname and $::hostname and just about every variant I can think of! I've even trawled through Google and Foreman docs and bug reports. Surely…
Kier
  • 55
  • 2
  • 10
0
votes
1 answer

how to read hiera value in custom factor

I would like to read value from the hiera for my custom factor. Is it possible ? I am going to populate a factor based on my hiera value. Please look at my following code for your reference. require 'facter' # Default for non-Linux…
ArunRaj
  • 1,780
  • 2
  • 26
  • 48
0
votes
1 answer

Unknown variable error compiling puppet script with facter/ruby dependency

facter --version 3.0.2 (commit 5dc120fa9db4c19150466b1bbd1d0cf42c87c6bd) puppet --version 4.2.1 Using this as an example: https://serverfault.com/questions/471995/how-do-i-check-if-a-user-exists-in-puppet I'm having some issues which do not seem to…
KevinY
  • 1,229
  • 1
  • 12
  • 27
0
votes
0 answers

Puppet variable assignment based on facter

The following code does not work: case $operatingsystemmajrelease { '6': { $TOUCH = "/bin/touch"} '7': { $TOUCH = "/usr/bin/touch"} } I also tried: case $operatingsystemmajrelease { "6": { $TOUCH='/bin/touch' } "7": { $TOUCH='/usr/bin/touch'…
user5191140
  • 61
  • 1
  • 1
  • 5
0
votes
2 answers

How to get this Ruby code to return nil?

How can I get the following Ruby code to return a nil, if the regvalue doesn't exist? Right now it works fine when there is something to return, but when there isn't it spits out this Error: Could not retrieve fact='notepadpp', resolution='': The …
tek0011
  • 147
  • 1
  • 4
  • 12
0
votes
1 answer

Ruby exec & extracting just part of the resutls

I'm trying to figure out how to do this from Ruby so that I can use it as a fact in Puppet: PS C:\> (& "$env:ProgramFiles\EMC NetWorker\nsr\bin\nsrports.exe" | Select-String -Pattern Service | Select-Oject -ExpandProperty line).split("…
GeneBean
  • 361
  • 4
  • 17