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
1
vote
1 answer

Injecting facter into file content - no implicit conversion of Hash into String

I want to inject some values from facter into a file content. It works with $fqdn since facter fqdn returns string. node default { file {'/tmp/README.md': ensure => file, content => $fqdn, # $(facter fqdn) owner => 'root', …
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
1
vote
0 answers

rspec/mocha error when testing facter fact

I've written a very simple facter fact. It looks like this: # Kubadmin facts # require 'json' Facter.add(:has_kubectl) do confine :kernel => :linux setcode do Facter::Core::Execution.which('kubectl') …
jaxxstorm
  • 12,422
  • 5
  • 57
  • 67
1
vote
1 answer

Puppet get / partition filesystem type using facter

I want to determine which filesystem type the / partition has. facter mountpoints shows: /home => { available => "1.81 GiB", available_bytes => 1946107904, capacity => "2.01%", device => "/dev/sda/home", filesystem => "xfs", options =>…
178877
  • 23
  • 4
1
vote
1 answer

Puppet - service state fact

Could some one give me quick answer if it is possible to get Service state using puppet facter? Basically in the Host facts section I would like to see: Apache: Running, version x.x.x Could someone point me to a right direction at least, on how to…
user2917823
  • 199
  • 1
  • 9
1
vote
1 answer

Puppet : get mountpoint using facter filter

I am trying to get a root partition (mountpoint => "/") name using Puppet facter. When I run "facter mountpoints", it shows multiple partitions. I would like to get the variable "/dev/md3" from the result. { / => { available => "893.71 GiB", …
Mike
  • 297
  • 5
  • 17
1
vote
0 answers

Puppet custom fact with ruby

I am new to ruby and am trying to get a puppet custom fact to work. Here is the code for the custom fact: Facter.add("mounts") do confine :osfamily => "RedHat" setcode do mountlist="" #Facter::Core::Execution.exec('/bin/mount | /bin/cut…
user3155618
  • 359
  • 1
  • 5
  • 14
1
vote
1 answer

Why could `rb_sysopen` not be found anymore by the custom fact since the upgrade to Puppet4?

The following custom fact: # returns latest packerversion, e.g. 0.10.1 Facter.add("latest_packerversion") do setcode do url="https://www.packer.io/downloads.html" file = open("#{url}") contents = file.read() match =…
030
  • 10,842
  • 12
  • 78
  • 123
1
vote
0 answers

Puppet - invalid facter options error message

I have a local Vagrant set-up running on my machine building out a Ubuntu 14.04 box with a LAMP stack. Vagrant kicks off the process to initialise the box and then it kicks into a puppet script to build and configure the box to my requirements.…
Adrian Walls
  • 852
  • 3
  • 19
  • 31
1
vote
2 answers

overwrite facter 'osfamily' value

I extended a module (pdxcat/collectd) by calling it from my module. The base module prefers to identify Amazon Linux OSfamily as 'Redhat' but the facter installed by puppet on the Amazon Linux OS reports the os as 'Linux'. I want to correct this bug…
uday
  • 142
  • 2
  • 12
1
vote
1 answer

Puppet fact, list software Windows

I'm new to puppet and ruby, and just tried to write custom fact but ... Having the following issue Facter.add("vsphere_installed") do confine :operatingsystem => :windows setcode do if …
rude
  • 13
  • 5
1
vote
1 answer

Facter - No operatingsystemmajrelease in my install (CentOS)

I have a weird happening on my servers: Foreman is running as puppetmaster and is correct: [root@foreman manifests]# facter | grep opera operatingsystem => CentOS operatingsystemmajrelease => 6 operatingsystemrelease => 6.5 On the two servers I…
Werner
  • 791
  • 1
  • 6
  • 23
1
vote
2 answers

I need a regex to match puppet facter facts

Puppet facts look like this: processors => {"models"=>["AMD Opteron(tm) Processor 6172", "AMD Opteron(tm) Processor 6172", "AMD Opteron(tm) Processor 6172", "AMD Opteron(tm) Processor 6172"], "count"=>4, "physicalcount"=>2} productname => VMware…
Jesse
  • 195
  • 1
  • 12
1
vote
1 answer

Puppet: Get MAC address for specified ethernet interface

I'm trying to populate a config file with a MAC address for a specified ethernet adapter. The name of the ethernet adapter (e.g. eth1) is a parameter of my defined type. When I try to populate a config file through puppet with an erb template which…
RikSaunderson
  • 3,505
  • 6
  • 32
  • 50
1
vote
1 answer

How can I create a custom :host_role fact from the hostname?

I'm looking to create a role based on host name prefix and I'm running into some problems. Ruby is new to me and although I've done extensive searching for a solution, I'm still confused. Host names look like…
Mike Reed
  • 13
  • 4
1
vote
1 answer

Passing an array with facter

Let us say I have an array of values ["node1.example.org", "node2.example.org"] And I want to pass this using facter, and use it in puppet at such: host { $nodes: ... } How can I do this?
user3458168
  • 97
  • 1
  • 4