[英]How to use setm in puppet
I would like to change a one property name ( " modcluster.proxylist " ) with setm Command in Puppet.我想在 Puppet 中使用setm命令更改一个属性名称(“ modcluster.proxylist ”)。 My following code is not working.
我的以下代码不起作用。 Any help is much appreciated.
任何帮助深表感谢。
augeas { "jboss_domain_config":
incl => "/opt/domain.xml",
lens => "Xml.lns",
context => "/files/opt/domain.xml",
onlyif => "match /files/opt/domain.xml/domain/server-groups/*/system-properties/*/#attribute/name modcluster.proxylist"
changes => "setm /files/opt/domain.xml/domain/server-groups server-group[.]/system-properties/property[.]/#attribute/value kumaran",
}
Following is my Source XML which i would like to change.以下是我想更改的源 XML。
<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>
There's quite a few problems in there.里面有不少问题。 Let's deal with them one by one:
让我们一一处理它们:
it seems the domain.xml
code you provide is wrong, as there's no domain
and server-groups
nodes as your Puppet code suggests.您提供的
domain.xml
代码似乎是错误的,因为没有您的 Puppet 代码所建议的domain
和server-groups
节点。 I take it there's two more levels around the code you provided:我认为您提供的代码还有两个级别:
<domain> <server-groups> <!-- the rest of the file --> <server-groups> <domain>
there's no need to set context
when using incl
and lens
, it's automatic使用
incl
和lens
时无需设置context
,它是自动的
setm
works: the first parameter is the nodeset on which Augeas will loop, the second one is the subnode to set and the third one the valuesetm
工作方式:第一个参数是 Augeas 将在其上循环的节点集,第二个是要设置的子节点,第三个是值setm
is inherently idempotent, there's really no need to use onlyif
here.setm
做的改变setm
是幂等的,真的没有必要在这里使用onlyif
。 Here's the result:结果如下:
augeas { "jboss_domain_config":
incl => "/tmp/domain.xml",
lens => "Xml.lns",
changes => "setm domain/server-groups/server-group system-properties/property[#attribute/name='modcluster.proxylist']/#attribute/value kumaran",
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.