using values of Puppet Facts in template erb file

asked 2016-11-01 14:25:28 -0500

I am trying to find how can we use puppet facts values into an template configuration erb file.

sample template variable to be configured

zk.l.conn=

expected "zk.l.conn" configured dynamically by puppet using puppet facts as below

zk.l.conn=ip-xx-31-xx-xxx.ec2.internal:2181,ip-xxx-31-xx- xxx.ec2.internal:2181,ip-172-xxx-xxx-xx.ec2.internal:2181

puppet facts data :

"zk-internal": [
          {
            "host": "ip-xx-31-xx-xxx.ec2.internal",
            "port": 2181,
            "priority": 2,
            "weight": 10
          },
          {
            "host": "ip-xxx-31-xx-xxx.ec2.internal",
            "port": 2181,
            "priority": 3,
            "weight": 10
          },
          {
            "host": "ip-172-xxx-xxx-xx.ec2.internal",
            "port": 2181,
            "priority": 1,
            "weight": 10
          }
        ],

Thank you

edit retag flag offensive close merge delete

Comments

1

https://docs.puppet.com/puppet/latest/reference/lang_template_erb.html https://docs.puppet.com/puppet/latest/reference/lang_facts_and_builtin_vars.html `$scope['::facts['os']']`

Kai Burghardt gravatar imageKai Burghardt ( 2016-11-02 07:23:01 -0500 )edit