jboss7.xpuppetpuppet-enterpriseaugeas

How to use conditional operation in augeas puppet


I can insert/edit any attributes or any text in XML file.

Is it possible to insert/edit any attributes or any text in XML File.

For eg: I would like to change the value of a property, If it is named as "modcluster.proxylist".

<server-group name="ServiceGroupOne" profile="full-ha">
    <system-properties>
        <property name="jboss.default.multicast.address" value="232.0.2.20" boot-time="true"/>
        <property name="modcluster.proxylist" value="192.168.79.77:7777" boot-time="true"/>
        <property name="modcluster.lbgroup" value="SearchGroupOne" boot-time="true"/>
    </system-properties>
</server-group>
<server-group name="ServiceGroupTwo" profile="full-ha">
    <system-properties>
        <property name="jboss.default.multicast.address" value="232.0.2.20" boot-time="true"/>
        <property name="modcluster.lbgroup" value="SearchGroupTwo" boot-time="true"/>
        <property name="modcluster.proxylist" value="192.168.79.77:7777" boot-time="true"/>
    </system-properties>
</server-group>
<server-group name="ServiceGroupThree" profile="full-ha">
    <system-properties>
        <property name="modcluster.lbgroup" value="CommonSearchGroup" boot-time="true"/>
        <property name="modcluster.proxylist" value="192.168.79.77:7777" boot-time="true"/>
        <property name="jboss.default.multicast.address" value="232.0.2.20" boot-time="true"/>
    </system-properties>
</server-group>

Solution

  • The augeas puppet type has an onlyif attribute which lets you decide whether it will be ran or not. That's pretty much the only conditional option there is for now.

    If your need gets quite complex, I'd recommend you write a Ruby augeasprovider instead.