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
0 answers

Puppet Hiera v5: Function lookup() did not find a value

I'm coming from Puppet 3 and try to rebuild my code on a new Puppet 6 system. I try to give my Agentnodes some sort of "stage_level" like productive or testing. Hiera can't find this stage_level although it is set in a Hiera file. The stage_level is…
heat
  • 1
  • 1
0
votes
1 answer

Assign nodes to specific hiera hierarchy

I have added in my hiera.yaml an hierarchy like this - "nodes/%{::certname}" - "locations/{::location}.yaml" - "groups/%{::group}.yaml" - common For the nodes it I know hiera looks them up through the nodes resource. But how does it work for…
0
votes
1 answer

Creating nested Puppet fact (Ruby) by iterating over gem query output

I have working Ruby code to query DNS details and create Puppet custom facts (puppet 5, Facter 3.11.6) however I am trying to modify it to create nested facts from the key/value pairs that the query obtains. Code that works to set individual facts…
xit
  • 135
  • 1
  • 12
0
votes
1 answer

Facter - How to check if directory exists

I'm trying to check if direcotory exists. I created subdir 'lib/facter' in my module directory and put file 'mycheck.rb' in it. Facter.add(:mycheck) do setcode do if Dir.exist? ('/mydir1') 'one' elseif Dir.exist? ('/mydir2') 'two' else …
0
votes
0 answers

Notify a module to rebuild facts from puppet run

Suppose I have a module in puppet that creates custom facts. But to do so, it requires a package package_a to be installed. Based on whether this package is there or not it will decide to generate the facts. This package is installed as part of the…
leoOrion
  • 1,833
  • 2
  • 26
  • 52
0
votes
2 answers

How to generate a key:value list wih given values from a python list

i have to solve the following task. First of all i'm using pyscard (python module to interact with smartcards) to query the smartcardreaders that are connected to the host. This works just fine and gives my a list of the connected readers. To make…
bku
  • 3
  • 1
0
votes
1 answer

In Puppet, how to use defined node variables in an if clause

In a puppet class how should I test if a variable has been set in a node? I use a VM name (like server1) and a domain name (like example.org) where users can reach the page. "example.org" won't be conveyed via a fact, so I need to pass it via a…
B3nny
  • 3
  • 1
  • 4
0
votes
0 answers

Error in Puppet agent 3.8 installation on cent OS 7.5 without internet

I am installing puppet agent 3.8.7 on cent OS 7.5. The OS was installed on a new VM and it is not connected to internet. I have created a yum repo which points to pulp repository. Below are the contents of my yum repo for puppet - [root@server ---…
NKumar
  • 546
  • 5
  • 14
0
votes
2 answers

Get array of strings from Facter into Puppet

In a module I'm working on, I need to check if specific users exist on a machine. The idea was to create a custom fact that contains an array of all users. In the module, it should iterate through the array and check if a specific user is part of…
Studentus
  • 49
  • 1
  • 10
0
votes
2 answers

Puppet - create NESTED custom fact

I have successfully created a .rb custom fact that parses a built-in fact to create a new value, however I am now trying to use it as nested custom fact for Puppet. The hierarchy I want to create is similar to built-in facts, eg running Facter (or…
xit
  • 135
  • 1
  • 12
0
votes
1 answer

apply config to group of servers in puppet + hiera

Need some help thinking. I have 200 servers and have to apply a specific configuration to 100. The only thing they share in common is the name prefix: they all start with zmb- hiera.yaml --- :backends: - yaml :yaml: :datadir: :hierarchy: -…
RASG
  • 5,988
  • 4
  • 26
  • 47
0
votes
1 answer

failing to pass argument to puppet apply with facts

I am trying to pass a facter argument to puppet apply. Here's what I tried: export FACTER_command="start" puppet apply site.pp $FACTER_command and in my code I have: exec { 'some_exec': command => '/bin/bash -c "/some/path/to/scripts.sh -t…
user1611830
  • 4,749
  • 10
  • 52
  • 89
0
votes
1 answer

Execute command on all puppet nodes

I would like execute below simple command in all of my nodes which returns me whether symbolic links are available using puppet facter. 'ls -l | grep lrw | grep data' How to run this command and collect the results from one client ? I do not have…
0
votes
2 answers

Puppet facter, how to set custom facts from yaml file?

I want to be able to set a number of different custom facts for puppet. It looks like there is a way to list all of these out in a yaml file and then load them in, but the documentation does not have the exact command to do that. How can I set…
Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
0
votes
0 answers

Puppet Passing Consul Token as Fact Into Hiera

I am converting one of my masterless modules to use Consul. How do I use external facts to pass in the Consul host and Consul token? These change in every environment and are not managed by Puppet. I am using the Puppet module…
Eric Aldinger
  • 125
  • 1
  • 6