简体   繁体   中英

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM