6
votes
Access arrays/hashes in facter 2 facts
For example like this:
notify { $::os[release][major] : }
Note that you need to set the option stringify_facts to false for this to work (default as of writing with Puppet 3.7.1: true).
5
votes
Accepted
Puppet: Pass facter value to class (sensu puppet module)
Single quotes prevent variables from getting expanded, so it should be like this:
subscriptions => [ 'sensu-default', 'centosJenkinsMaster', $::fqdn, ],
I'd recommend you to use ...
5
votes
Accepted
Trouble using hiera in masterless setup and getting values set for classes
Try this:
hiera cluster '::nodetype=diskless'
See fact-sources documentation
4
votes
Accepted
Puppet directory environments and the $environment variable
The $environment variable isn't technically a fact - it is set by the agent from its puppet.conf, instead of a fact. You'll need to edit it in the agent's puppet.conf instead of facts.d.
An ENC can ...
4
votes
"Unsupported osfamily: Linux" when trying to install Apache using Puppet
Don't use Amazon Linux. The Puppet Labs Apache module is not compatible with Amazon Linux. You will need to use one of the distributions which it is compatible with, or create your own Puppet module.
3
votes
how i do use puppet variable in facter custom facts
If you want to use a manifest variable in a custom fact, you can't. This is because facts are evaluated on the client before the catalog (collection of manifests) is compiled. So at the point that ...
3
votes
Extract nested hash facts from puppet's facter command-line tool. How?
Nested fact values can be viewed in the CLI by using a dot between variables
e.g. to retrieve os['release']['minor'] in the CLI type:
facter os.release.minor
EDIT:
Apperently this only works with ...
3
votes
"Unsupported osfamily: Linux" when trying to install Apache using Puppet
After looking at it with a fresh pair of eyes today, I've found that Facter v1.7.0 includes a fix that classifies Amazon Linux as "RedHat" correctly: https://github.com/puppetlabs/facter/commit/...
3
votes
Accepted
Facter - custom fact, returns empty data set when invoked by Puppet agent
This is actually a bug in Puppet 3.6, apparently.
As an aside, note that using agents that are newer than the master is not generally supported.
2
votes
Accepted
Why aren't my puppet variables getting assigned by Vagrant's puppet.facter options?
Thanks to @SebastianWeigand, a coworker of mine, I've found that the use of cammel-case in the variable names was causing the problem. Switching to "variableone" and "variabletwo" in both sides fixed ...
2
votes
Access arrays/hashes in facter 2 facts
You can access facts from manifests by using hashes, like this:
notify { $::os['release']['major']: }
Example:
# puppet apply -e 'notify { $::os['release']['major']: }'
Notice: Compiled catalog for ...
2
votes
Access arrays/hashes in facter 2 facts
Should be possible access it as usual hash datatype.
Example:
$myhash = {os => {
"name"=>"CentOS",
"family"=>"RedHat",
"release"=>{
...
2
votes
Accepted
Puppet - determine if another host is reachable?
So this is for swapping something in via a config variable in a template?
I think the best way to do this would be to write a custom fact in Ruby that does the speed and reachability testing, then ...
2
votes
Accepted
Filter puppet pluginsync
There is no way to filter plugins.
But as you say in your comment, you need to write the facts/types to handle the OS they're running on. For types and providers you exit early.
For facts you can use ...
2
votes
Accepted
Can't install Facter 1.7.0 on Amazon Linux using PuppetLabs Yum repositories
The packages are not showing up as updates very probably because of priority settings.
You could fix that by:
echo -e "[main]\nenabled = 0" > /etc/yum/pluginconf.d/priorities.conf
However, ...
2
votes
Blank value in custom puppet fact
For the record!
Facter.add(:myhost) do
confine :kernel => "Linux"
fh = File.open('/etc/enc_params.conf')
fh.each_line do |line|
if line =~ /\Amyhost.*\s(\w+)\Z/
r = $1
setcode ...
2
votes
Accepted
Facter (2.4.4) sets ipaddress to docker0 and not the ethernet interface (CentOS7)
This is a problem with the default ipaddress fact, it's a bit dumb. We use a custom one called default_if which is based on the default route (works on Debian, may need adapting to CentOS):
Facter....
2
votes
Modify puppet nodes.pp with regex based on network (facter) subnet coverage - needs peer review
This will not work as shown. First, the regex is no good, but also node matchers are based on certname, which is the FQDN of the host. That's not to say you can't do it, but it would require some more ...
2
votes
Accepted
Facter does not show custom Puppet facts
Quoting from facter --help:
-p, --puppet (Deprecated: use puppet facts instead) Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.
With current ...
1
vote
Accepted
How to use custom facts with rspec Puppet
In your spec/spec_helper.rb file you can add the following:
RSpec.configure do |c|
c.default_facts = { :pskkey_generate => '...' }
end
See https://github.com/rodjek/rspec-puppet#default_facts
1
vote
puppet: fact in manifest with dot
Accessing facts has changed in version 4. Try accessing the fact via the $facts hash, $facts['ipaddress_enp0s8.25'], instead of using a top scope variable.
You can still use top scope variables to ...
1
vote
Accepted
Use Puppetdb for ENC variable?
Can I do this,
Yes that is possible. One could create a custom fact in a puppet module, e.g. run some ruby code in order to get the version of installed software:
module_name/lib/facter/customfact....
1
vote
Use Puppetdb for ENC variable?
puppet facts are always informations sent by the agent to the master. Thus you can't set a fact on the puppetmaster side.
But, you have the option to configure the agent environment with puppet ...
1
vote
Accepted
How to access facter GCE metadata
The error gce is not a hash or array suggests you're on Puppet 3.x (rather than 4.x) which treats all facts as strings, so to access the value inside the hash you will need to turn off the ...
1
vote
Extract nested hash facts from puppet's facter command-line tool. How?
That's not what facter is supposed to do. If you use it within puppet as expected, you can access every fact separately.
To a certain degree, you can work around this if you use JSON output:
...
1
vote
Facter: Custom-fact-script "was parsed but returned an empty data set"
The official documentation helped me realize the script must produce output in the form of key=value. Thus, a single script can generate many different sets of information. (Now I realize why facter ...
1
vote
"Unsupported osfamily: Linux" when trying to install Apache using Puppet
The problem seems to be in the file /usr/lib/ruby/site_ruby/1.8/facter/osfamily.rb
which ends up using the osoperatingsystem as osfamily in the case of Amazon Linux.
Line 19 is:
when "RedHat", "...
1
vote
Filter puppet pluginsync
Puppet itself does not support filtering the lists of plugins to be synced.
However, you can patch puppet to support this using the pluginsync_filter patch from CERN.
Afterwards you can whitelist ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
facter × 38puppet × 37
hiera × 3
centos × 2
debian × 2
amazon-ec2 × 2
ruby × 2
puppetmaster × 2
amazon-linux × 2
linux × 1
networking × 1
amazon-web-services × 1
centos7 × 1
ldap × 1
ansible × 1
yum × 1

regex × 1
openstack × 1
hostname × 1
user-accounts × 1
groups × 1
vagrant × 1
ansible-playbook × 1
awk × 1