0

I would like to change values in domain.xml ( JBoss Configuration file ). Please suggest me the best way to do it with sample examples to change it.

I have found the following ways. But No idea, How to use the following functions for xml files.

( i ) inline_template

( ii ) regsubst

I have to change the following four property as per each group. For Each Group, values of the 4 properties will be changed. Please suggest me the best Industry practise standard.

<system-properties>
    <property name="jboss.default.multicast.address" value="230.0.1.1" boot-time="true"/>
    <property name="modcluster.balancer.name" value="mylb" boot-time="true"/>
    <property name="modcluster.proxylist" value="172.28.168.153:6777" boot-time="true"/>
    <property name="mycluster.modcluster.lbgroup" value="coollb" boot-time="true"/>
</system-properties>
ArunRaj
  • 1,780
  • 2
  • 26
  • 48

1 Answers1

3

inline_template are executed on master, so they won't solve your problem.

The easiest solution is erb templates. But this means that you will control from puppet the entire file, not only the properties.

The best solution: there seems to be an augeas lens for xml: https://twiki.cern.ch/twiki/bin/view/Main/TerjeAndersenAugeas

Edit:

  • have an erb template in your module (templates/jboss_config.xml.erb)

    <bla bla>....
    <system-properties>
        <property name="jboss.default.multicast.address" value="<%= @multicast_address %>" boot-time="true"/>
        <property name="modcluster.balancer.name" value="<%= @balancer_name %>" boot-time="true"/>
        <property name="modcluster.proxylist" value="<%= @proxylist %>" boot-time="true"/>
        <property name="mycluster.modcluster.lbgroup" value="<%= @lbgroup %>" boot-time="true"/>
    </system-properties>
    </bla bla>....
    

In your puppet class declare the parameters/variables (those can came from hiera also, if you want to do overwrites based on some facts):

    $multicast_address = '230.0.1.1'
    $balancer_name = 'mylb'
    $proxylist = '172.28.168.153:6777'
    $lbgroup = 'coollb'

    # and write your file:
    file { 'jboss_config_file':
      ensure  => file,
      path    => '/path/to/jboss/config/file.xml',
      content => template("${module_name}/jboss_config.xml.erb"),
    }
cristi
  • 2,019
  • 1
  • 22
  • 31
  • Can you provide any samples for erb templates ? If inline_template done changes in Master, Will it be populated to Slave ? – ArunRaj Nov 05 '15 at 06:52
  • 1
    Both of them are executed on master, but their standard usage is different. inline_template are usually used to assign values to variables and templates are used to create files on hosts. So my first statement is useless for this case. I will come back with an example. – cristi Nov 05 '15 at 07:19