in DevOps by
Q:
Can I access environment variables with Facter in Puppet?

1 Answer

0 votes
by

I will suggest you to start this answer by saying:

Not directly. However, Facter reads in custom facts from a special subset of environment variables. Any environment variable with a prefix of FACTER_ will be converted into a fact when Facter runs.

Now explain the interviewer with an example:

1

2

3

4 $ FACTER_FOO=”bar”

 $ export FACTER_FOO</span>

 $ facter | grep  ‘foo’</span>

   foo => bar

The value of the FACTER_FOO environment variable would now be available in your Puppet manifests as $foo, and would have a value of ‘bar’. Using shell scripting to export an arbitrary subset of environment variables as facts is left as an exercise for the reader.

Click here to read more about DevOps
Click here to read more about Insurance

Related questions

0 votes
asked Nov 5, 2019 in Ansible by Robin
0 votes
0 votes
asked May 26, 2020 in Amazon Elastic Compute Cloud EC2 by Indian
+1 vote
asked May 29, 2020 in Hadoop by sharadyadav1986
0 votes
asked May 14, 2020 in DevOps by sharadyadav1986
0 votes
asked May 14, 2020 in DevOps by sharadyadav1986
0 votes
...