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

I want to execute my custom facts which I made it in facter

# hardware_platform.rb Facter.add('hardware_platform') do setcode do Facter::Core::Execution.exec('/bin/uname --hardware-platform') end end I want to execute it and when I gave facter --puppet. This information is not coming in the facter…
ra_pri
  • 155
  • 2
  • 4
  • 20
0
votes
0 answers

how to create facts in puppet server

Puppet Master has 3.6.2 version installed in RHEL 6.6. I have created a fact on agent server(Puppet 3.8.4) inside /var/lib/puppet/lib/facter/last_run.rb. The content of the file was simply to echo system date: require…
kanchan
  • 1
  • 4
0
votes
1 answer

puppet onlyif logical expression

I am trying to set up a Puppet exec resource for a Windows Server based on a Facter variable. But, it looks like onlyif accepts only command files and not an inline expression. Could someone please help me set this expression in onlyif (either as a…
Raghav
  • 2,890
  • 7
  • 36
  • 56
0
votes
0 answers

Shell command from custom puppet fact?

I'm reading that a shell command can be executed from custom facts with Facter::Core::Execution.exec. I've made a fact with the following code: Facter.add(:controller_id) do setcode do Facter::Core::Execution.exec('/usr/bin/jq -r .device._id…
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
0
votes
1 answer

Access facter variable from within ruby

Is it possible to access a facter variable from within ruby? if %{virtual} == 'virtualbox' result = 'changeit' else result = c[1]['passwd'] end So $::virtual is a variable in facter.
0
votes
0 answers

Writing custom fact for Puppet on Windows in Ruby

I'm trying to write a fact for Puppet on Windows in Ruby. The fact should display the value of a server parameter from the puppet.conf file. This is very simple code and works perfectly on Linux. It should also work on Windows with a changed path…
mila002
  • 327
  • 3
  • 14
0
votes
1 answer

Puppet get root partition name using facter

I am trying to get a root partition (mount => "/") name using Puppet facter. When I run "facter partitions", it shows three partitions. I would like to get the variable "sda3" from the result. { /dev/sda1 => { size => "1.00 MiB", …
Mike
  • 297
  • 5
  • 17
0
votes
1 answer

Invalid byte sequence in UTF-8 Ruby facter

I'm trying to write a fact for Puppet. I have an array with usernames array = ["user1", "user2", "user3"] and then a code array.each do |item| temp_data << Facter::Core::Execution.exec("net user #{item} /DOMAIN") end search_text =…
mila002
  • 327
  • 3
  • 14
0
votes
3 answers

Converting array to json in Ruby (Puppet, facter)

I'm writing a fact for Puppet in Ruby. I have an array array = [[["User", "Username"], ["Date", "16.12.2014"]], [["User1", "Username1"], ["Date1", "17.12.2014"]]] I want to convert it to json. I tried to convert it to hash first, but doing like…
mila002
  • 327
  • 3
  • 14
0
votes
1 answer

Ansible facter - CentOS - not showing any facter_ variables

I have two boxes: - CentOS 7.2.x.x vagrant box and - Debian/Ubuntu 14.04 trusty vagrant box On both, I installed Ansible (using their preferred package manager method) and ansible/ansible-playbook commands are working perfectly on both boxes. On…
AKS
  • 16,482
  • 43
  • 166
  • 258
0
votes
1 answer

How to use Facter values in Ruby template with Puppet

I am trying to figure out how I can use Facter facts inside a Ruby template erb file configured with Puppet. Sample Ruby template variable zk.l.conn= Expected config file output from Puppet zk.l.conn=ip-xx-31-xx-xxx.ec2.internal:2181,ip-xxx-31-xx-…
rocky
  • 137
  • 1
  • 2
  • 6
0
votes
1 answer

Unable to use $facts as a hash in the puppet manifest

Here is the manifest code which is failing: each( $facts['partitions'] ) |$name, $device| { notice( "${facts['hostname']} has device ${name} with size ${device['size']}" ) } The error: [manifests]$puppet apply…
Jay Rajput
  • 1,813
  • 17
  • 23
0
votes
1 answer

Puppet: Dependency chain not getting executed in order

I have an issue wherein i am trying to set external facts and then copy a template file which gets populated with values from hiera yaml file. The template file is dependent on certain facts(such as the owner and group of the of the template file)…
Iowa
  • 2,171
  • 4
  • 22
  • 31
0
votes
0 answers

Multiple control conditions validation in puppet

I need to validate agent like memory, processor, and port connectivity before running my other manifest files. So I've created a manifest like following by keeping global facts with and statement and exec resource. class vc { #Validateing Infra…
Dev
  • 371
  • 1
  • 4
  • 19
0
votes
0 answers

Puppet: Copy fact file based on hostname

Is there a possibility of deploying custom facts based on the hostname/ipaddress of the machine. Suppose i have 2 custom fact files, machine1.rb #contains facts specific to machine1 machine2.rb #contains facts specific to machine2 Now my requirement…
Iowa
  • 2,171
  • 4
  • 22
  • 31